diff --git a/MCP/go/go.mod b/MCP/go/go.mod index 2132371..41b5677 100644 --- a/MCP/go/go.mod +++ b/MCP/go/go.mod @@ -2,7 +2,7 @@ module github.com/github-v3-rest-api/mcp-server go 1.24.4 -require github.com/mark3labs/mcp-go v0.38.0 +require github.com/mark3labs/mcp-go v0.39.1 require ( github.com/bahlo/generic-list-go v0.2.0 // indirect diff --git a/MCP/go/go.sum b/MCP/go/go.sum index 05498e4..4bdf8a4 100644 --- a/MCP/go/go.sum +++ b/MCP/go/go.sum @@ -19,8 +19,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mark3labs/mcp-go v0.38.0 h1:E5tmJiIXkhwlV0pLAwAT0O5ZjUZSISE/2Jxg+6vpq4I= -github.com/mark3labs/mcp-go v0.38.0/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g= +github.com/mark3labs/mcp-go v0.39.1 h1:2oPxk7aDbQhouakkYyKl2T4hKFU1c6FDaubWyGyVE1k= +github.com/mark3labs/mcp-go v0.39.1/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= diff --git a/MCP/go/models/models.go b/MCP/go/models/models.go index 7844060..9ba9b6a 100644 --- a/MCP/go/models/models.go +++ b/MCP/go/models/models.go @@ -10,10122 +10,10122 @@ type Tool struct { Handler func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actor map[string]interface{} `json:"actor"` // The actor who updated the ruleset - Updated_at string `json:"updated_at"` - Version_id int `json:"version_id"` // The ID of the previous version of the ruleset -} - -// Webhooksrelease represents the Webhooksrelease schema from the OpenAPI specification -type Webhooksrelease struct { - Tarball_url string `json:"tarball_url"` - Url string `json:"url"` - Body string `json:"body"` +// GeneratedType_Timeline_comment_event represents the GeneratedType_Timeline_comment_event schema from the OpenAPI specification +type GeneratedType_Timeline_comment_event struct { Node_id string `json:"node_id"` - Assets_url string `json:"assets_url"` - Upload_url string `json:"upload_url"` - Author map[string]interface{} `json:"author"` + Url string `json:"url"` // URL for the issue comment + User GeneratedType_Simple_user `json:"user"` // A GitHub user. + Id int `json:"id"` // Unique identifier of the issue comment + Updated_at string `json:"updated_at"` + Body_html string `json:"body_html,omitempty"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Body_text string `json:"body_text,omitempty"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. Created_at string `json:"created_at"` - Prerelease bool `json:"prerelease"` // Whether the release is identified as a prerelease or a full release. - Tag_name string `json:"tag_name"` // The name of the tag. - Zipball_url string `json:"zipball_url"` - Assets []map[string]interface{} `json:"assets"` - Name string `json:"name"` - Id int `json:"id"` + Issue_url string `json:"issue_url"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Author_association string `json:"author_association"` // How the author is associated with the repository. Html_url string `json:"html_url"` - Published_at string `json:"published_at"` - Target_commitish string `json:"target_commitish"` // Specifies the commitish value that determines where the Git tag is created from. - Discussion_url string `json:"discussion_url,omitempty"` - Draft bool `json:"draft"` // Whether the release is a draft or published - Reactions map[string]interface{} `json:"reactions,omitempty"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository map[string]interface{} `json:"repository,omitempty"` // A git repository - Sender GeneratedType `json:"sender"` // A GitHub user. - Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` // The changes to the team if the action was `edited`. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Body string `json:"body,omitempty"` // Contents of the issue comment + Event string `json:"event"` } -// Project represents the Project schema from the OpenAPI specification -type Project struct { - Updated_at string `json:"updated_at"` +// GeneratedType_Pull_request represents the GeneratedType_Pull_request schema from the OpenAPI specification +type GeneratedType_Pull_request struct { + Id int64 `json:"id"` + Assignee GeneratedType_Nullable_simple_user `json:"assignee"` // A GitHub user. + Statuses_url string `json:"statuses_url"` Created_at string `json:"created_at"` - Private bool `json:"private,omitempty"` // Whether or not this project can be seen by everyone. Only present if owner is an organization. - Number int `json:"number"` - State string `json:"state"` // State of the project; either 'open' or 'closed' - Id int `json:"id"` - Name string `json:"name"` // Name of the project - Columns_url string `json:"columns_url"` - Body string `json:"body"` // Body of the project - Creator GeneratedType `json:"creator"` // A GitHub user. + Html_url string `json:"html_url"` + Rebaseable bool `json:"rebaseable,omitempty"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + State string `json:"state"` // State of this Pull Request. Either `open` or `closed`. + Review_comments_url string `json:"review_comments_url"` + Base map[string]interface{} `json:"base"` + Review_comments int `json:"review_comments"` + Commits_url string `json:"commits_url"` + Assignees []GeneratedType_Simple_user `json:"assignees,omitempty"` + Comments_url string `json:"comments_url"` + Milestone GeneratedType_Nullable_milestone `json:"milestone"` // A collection of related issues and pull requests. Node_id string `json:"node_id"` + Issue_url string `json:"issue_url"` + Active_lock_reason string `json:"active_lock_reason,omitempty"` Url string `json:"url"` - Html_url string `json:"html_url"` - Organization_permission string `json:"organization_permission,omitempty"` // The baseline permission that all organization members have on this project. Only present if owner is an organization. - Owner_url string `json:"owner_url"` + Links map[string]interface{} `json:"_links"` + Merged bool `json:"merged"` + Merge_commit_sha string `json:"merge_commit_sha"` + Commits int `json:"commits"` + Updated_at string `json:"updated_at"` + User GeneratedType_Simple_user `json:"user"` // A GitHub user. + Mergeable bool `json:"mergeable"` + Title string `json:"title"` // The title of the pull request. + Changed_files int `json:"changed_files"` + Deletions int `json:"deletions"` + Mergeable_state string `json:"mergeable_state"` + Number int `json:"number"` // Number uniquely identifying the pull request within its repository. + Diff_url string `json:"diff_url"` + Additions int `json:"additions"` + Locked bool `json:"locked"` + Requested_reviewers []GeneratedType_Simple_user `json:"requested_reviewers,omitempty"` + Head map[string]interface{} `json:"head"` + Maintainer_can_modify bool `json:"maintainer_can_modify"` // Indicates whether maintainers can modify the pull request. + Body string `json:"body"` + Requested_teams []GeneratedType_Team_simple `json:"requested_teams,omitempty"` + Labels []map[string]interface{} `json:"labels"` + Auto_merge GeneratedType_Auto_merge `json:"auto_merge"` // The status of auto merging a pull request. + Closed_at string `json:"closed_at"` + Patch_url string `json:"patch_url"` + Draft bool `json:"draft,omitempty"` // Indicates whether or not the pull request is a draft. + Merged_by GeneratedType_Nullable_simple_user `json:"merged_by"` // A GitHub user. + Review_comment_url string `json:"review_comment_url"` + Comments int `json:"comments"` + Merged_at string `json:"merged_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Author map[string]interface{} `json:"author"` // Information about the Git author - Committer map[string]interface{} `json:"committer"` // Information about the Git committer - Id string `json:"id"` // SHA for the commit - Message string `json:"message"` // Message describing the purpose of the commit - Timestamp string `json:"timestamp"` // Timestamp of the commit - Tree_id string `json:"tree_id"` // SHA for the commit's tree +// GeneratedType_Copilot_ide_chat represents the GeneratedType_Copilot_ide_chat schema from the OpenAPI specification +type GeneratedType_Copilot_ide_chat struct { + Editors []map[string]interface{} `json:"editors,omitempty"` + Total_engaged_users int `json:"total_engaged_users,omitempty"` // Total number of users who prompted Copilot Chat in the IDE. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - State string `json:"state"` // The state of the user's membership in the team. - Url string `json:"url"` - Role string `json:"role"` // The role of the user in the team. +// GeneratedType_Codespaces_public_key represents the GeneratedType_Codespaces_public_key schema from the OpenAPI specification +type GeneratedType_Codespaces_public_key struct { + Key_id string `json:"key_id"` // The identifier for the key. + Title string `json:"title,omitempty"` + Url string `json:"url,omitempty"` + Created_at string `json:"created_at,omitempty"` + Id int `json:"id,omitempty"` + Key string `json:"key"` // The Base64 encoded public key. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Registry_package map[string]interface{} `json:"registry_package"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Secret_scanning_location_pull_request_review_comment represents the GeneratedType_Secret_scanning_location_pull_request_review_comment schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_pull_request_review_comment struct { + Pull_request_review_comment_url string `json:"pull_request_review_comment_url"` // The API URL to get the pull request review comment where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Contexts_url string `json:"contexts_url,omitempty"` - Enforcement_level string `json:"enforcement_level,omitempty"` - Strict bool `json:"strict,omitempty"` - Url string `json:"url,omitempty"` - Checks []map[string]interface{} `json:"checks"` - Contexts []string `json:"contexts"` +// GeneratedType_Repository_rule_detailed represents the GeneratedType_Repository_rule_detailed schema from the OpenAPI specification +type GeneratedType_Repository_rule_detailed struct { } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Note string `json:"note"` - Archived bool `json:"archived,omitempty"` // Whether or not the card is archived +// Webhooksworkflowjobrun represents the Webhooksworkflowjobrun schema from the OpenAPI specification +type Webhooksworkflowjobrun struct { + Name interface{} `json:"name"` + Status string `json:"status"` Updated_at string `json:"updated_at"` - Url string `json:"url"` - Column_url string `json:"column_url"` - Content_url string `json:"content_url,omitempty"` + Conclusion interface{} `json:"conclusion"` Created_at string `json:"created_at"` - Creator GeneratedType `json:"creator"` // A GitHub user. - Id int64 `json:"id"` // The project card's ID - Project_url string `json:"project_url"` - Column_name string `json:"column_name,omitempty"` - Node_id string `json:"node_id"` - Project_id string `json:"project_id,omitempty"` -} - -// Import represents the Import schema from the OpenAPI specification -type Import struct { - Project_choices []map[string]interface{} `json:"project_choices,omitempty"` - Commit_count int `json:"commit_count,omitempty"` - Large_files_count int `json:"large_files_count,omitempty"` - Tfvc_project string `json:"tfvc_project,omitempty"` - Authors_count int `json:"authors_count,omitempty"` - Push_percent int `json:"push_percent,omitempty"` - Use_lfs bool `json:"use_lfs,omitempty"` - Failed_step string `json:"failed_step,omitempty"` - Has_large_files bool `json:"has_large_files,omitempty"` + Environment string `json:"environment"` Html_url string `json:"html_url"` - Url string `json:"url"` - Error_message string `json:"error_message,omitempty"` - Status string `json:"status"` - Repository_url string `json:"repository_url"` - Vcs string `json:"vcs"` - Svc_root string `json:"svc_root,omitempty"` - Authors_url string `json:"authors_url"` - Svn_root string `json:"svn_root,omitempty"` - Large_files_size int `json:"large_files_size,omitempty"` - Message string `json:"message,omitempty"` - Status_text string `json:"status_text,omitempty"` - Import_percent int `json:"import_percent,omitempty"` - Vcs_url string `json:"vcs_url"` // The URL of the originating repository. + Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Scope string `json:"scope"` // The scope of the membership. Currently, can only be `team`. - Sender map[string]interface{} `json:"sender"` +// GeneratedType_Webhook_project_column_created represents the GeneratedType_Webhook_project_column_created schema from the OpenAPI specification +type GeneratedType_Webhook_project_column_created struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_column Webhooksprojectcolumn `json:"project_column"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Team Webhooksteam `json:"team"` // Groups of organization members that gives permissions on specified repositories. - Member Webhooksuser `json:"member"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Start_line float64 `json:"start_line"` // Line number at which the secret starts in the file - End_line float64 `json:"end_line"` // Line number at which the secret ends in the file - Path string `json:"path"` // The file path in the repository - Start_column float64 `json:"start_column"` // The column at which the secret starts within the start line when the file is interpreted as 8BIT ASCII - End_column float64 `json:"end_column"` // The column at which the secret ends within the end line when the file is interpreted as 8BIT ASCII - Blob_sha string `json:"blob_sha"` // SHA-1 hash ID of the associated blob - Blob_url string `json:"blob_url"` // The API URL to get the associated blob resource - Commit_sha string `json:"commit_sha"` // SHA-1 hash ID of the associated commit - Commit_url string `json:"commit_url"` // The API URL to get the associated commit resource } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Conclusion string `json:"conclusion"` - Status string `json:"status"` // The phase of the lifecycle that the check is currently in. Statuses of waiting, requested, and pending are reserved for GitHub Actions check runs. +// Reaction represents the Reaction schema from the OpenAPI specification +type Reaction struct { + Id int `json:"id"` Node_id string `json:"node_id"` - Output map[string]interface{} `json:"output"` - Pull_requests []GeneratedType `json:"pull_requests"` // Pull requests that are open with a `head_sha` or `head_branch` that matches the check. The returned pull requests do not necessarily indicate pull requests that triggered the check. - Deployment GeneratedType `json:"deployment,omitempty"` // A deployment created as the result of an Actions check run from a workflow that references an environment - Head_sha string `json:"head_sha"` // The SHA of the commit that is being checked. - Id int64 `json:"id"` // The id of the check. - External_id string `json:"external_id"` - Html_url string `json:"html_url"` - Completed_at string `json:"completed_at"` - Url string `json:"url"` - Details_url string `json:"details_url"` - Name string `json:"name"` // The name of the check. - Started_at string `json:"started_at"` - App GeneratedType `json:"app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Check_suite map[string]interface{} `json:"check_suite"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request GeneratedType `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Label Webhookslabel `json:"label"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Content string `json:"content"` // The reaction to use + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url"` - Key string `json:"key"` - Name string `json:"name"` +// GeneratedType_Branch_restriction_policy represents the GeneratedType_Branch_restriction_policy schema from the OpenAPI specification +type GeneratedType_Branch_restriction_policy struct { Url string `json:"url"` + Users []map[string]interface{} `json:"users"` + Users_url string `json:"users_url"` + Apps []map[string]interface{} `json:"apps"` + Apps_url string `json:"apps_url"` + Teams []map[string]interface{} `json:"teams"` + Teams_url string `json:"teams_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` - Effective_date string `json:"effective_date"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Previous_marketplace_purchase map[string]interface{} `json:"previous_marketplace_purchase,omitempty"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Number int `json:"number"` // The unique sequence number of a team discussion. - Url string `json:"url"` +// GeneratedType_Team_discussion represents the GeneratedType_Team_discussion schema from the OpenAPI specification +type GeneratedType_Team_discussion struct { + Author GeneratedType_Nullable_simple_user `json:"author"` // A GitHub user. + Private bool `json:"private"` // Whether or not this discussion should be restricted to team members and organization owners. Title string `json:"title"` // The title of the discussion. + Updated_at string `json:"updated_at"` + Created_at string `json:"created_at"` Comments_count int `json:"comments_count"` - Html_url string `json:"html_url"` + Body_version string `json:"body_version"` // The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + Number int `json:"number"` // The unique sequence number of a team discussion. Last_edited_at string `json:"last_edited_at"` - Body string `json:"body"` // The main text of the discussion. - Pinned bool `json:"pinned"` // Whether or not this discussion should be pinned for easy retrieval. - Created_at string `json:"created_at"` - Private bool `json:"private"` // Whether or not this discussion should be restricted to team members and organization owners. - Author GeneratedType `json:"author"` // A GitHub user. - Reactions GeneratedType `json:"reactions,omitempty"` - Updated_at string `json:"updated_at"` - Team_url string `json:"team_url"` - Node_id string `json:"node_id"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Url string `json:"url"` Body_html string `json:"body_html"` - Body_version string `json:"body_version"` // The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + Html_url string `json:"html_url"` + Team_url string `json:"team_url"` + Body string `json:"body"` // The main text of the discussion. Comments_url string `json:"comments_url"` + Node_id string `json:"node_id"` + Pinned bool `json:"pinned"` // Whether or not this discussion should be pinned for easy retrieval. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Comments_url string `json:"comments_url"` - Committer GeneratedType `json:"committer"` // Metaproperties for Git author/committer information. - Author GeneratedType `json:"author"` // A GitHub user. - Commit map[string]interface{} `json:"commit"` - Html_url string `json:"html_url"` - Sha string `json:"sha"` - Url string `json:"url"` - Repository GeneratedType `json:"repository"` // Minimal Repository - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` +// Activity represents the Activity schema from the OpenAPI specification +type Activity struct { + Timestamp string `json:"timestamp"` // The time when the activity occurred. + Activity_type string `json:"activity_type"` // The type of the activity that was performed. + Actor GeneratedType_Nullable_simple_user `json:"actor"` // A GitHub user. + After string `json:"after"` // The SHA of the commit after the activity. + Before string `json:"before"` // The SHA of the commit before the activity. + Id int `json:"id"` Node_id string `json:"node_id"` - Parents []map[string]interface{} `json:"parents"` - Score float64 `json:"score"` + Ref string `json:"ref"` // The full Git reference, formatted as `refs/heads/`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pusher_type string `json:"pusher_type"` // The pusher type for the event. Can be either `user` or a deploy key. - Ref string `json:"ref"` // The [`git ref`](https://docs.github.com/rest/git/refs#get-a-reference) resource. - Ref_type string `json:"ref_type"` // The type of Git ref object deleted in the repository. +// Webhooksteam represents the Webhooksteam schema from the OpenAPI specification +type Webhooksteam struct { + Deleted bool `json:"deleted,omitempty"` + Members_url string `json:"members_url,omitempty"` + Parent map[string]interface{} `json:"parent,omitempty"` + Permission string `json:"permission,omitempty"` // Permission that the team will have for its repositories + Repositories_url string `json:"repositories_url,omitempty"` + Privacy string `json:"privacy,omitempty"` + Slug string `json:"slug,omitempty"` + Description string `json:"description,omitempty"` // Description of the team + Id int `json:"id"` // Unique identifier of the team + Notification_setting string `json:"notification_setting,omitempty"` + Html_url string `json:"html_url,omitempty"` + Name string `json:"name"` // Name of the team + Node_id string `json:"node_id,omitempty"` + Url string `json:"url,omitempty"` // URL for the team } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Public_members_url string `json:"public_members_url"` - Events_url string `json:"events_url"` - Id int `json:"id"` - Members_url string `json:"members_url"` - Repos_url string `json:"repos_url"` +// Status represents the Status schema from the OpenAPI specification +type Status struct { + Description string `json:"description"` + Updated_at string `json:"updated_at"` Url string `json:"url"` - Hooks_url string `json:"hooks_url"` - Avatar_url string `json:"avatar_url"` - Issues_url string `json:"issues_url"` Node_id string `json:"node_id"` - Description string `json:"description"` - Login string `json:"login"` + State string `json:"state"` + Target_url string `json:"target_url"` + Context string `json:"context"` + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. + Avatar_url string `json:"avatar_url"` + Created_at string `json:"created_at"` + Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Avatar_url string `json:"avatar_url"` - Site_admin bool `json:"site_admin"` +// Team represents the Team schema from the OpenAPI specification +type Team struct { + Description string `json:"description"` + Name string `json:"name"` Node_id string `json:"node_id"` - Received_events_url string `json:"received_events_url"` - Assignment string `json:"assignment,omitempty"` // Determines if the user has a direct, indirect, or mixed relationship to a role - User_view_type string `json:"user_view_type,omitempty"` - Email string `json:"email,omitempty"` + Privacy string `json:"privacy,omitempty"` Url string `json:"url"` - Starred_at string `json:"starred_at,omitempty"` - Starred_url string `json:"starred_url"` - TypeField string `json:"type"` - Events_url string `json:"events_url"` - Gravatar_id string `json:"gravatar_id"` - Id int `json:"id"` - Name string `json:"name,omitempty"` - Subscriptions_url string `json:"subscriptions_url"` - Inherited_from []GeneratedType `json:"inherited_from,omitempty"` // Team the user has gotten the role through - Followers_url string `json:"followers_url"` - Organizations_url string `json:"organizations_url"` - Repos_url string `json:"repos_url"` - Gists_url string `json:"gists_url"` - Following_url string `json:"following_url"` Html_url string `json:"html_url"` - Login string `json:"login"` + Id int `json:"id"` + Notification_setting string `json:"notification_setting,omitempty"` + Slug string `json:"slug"` + Members_url string `json:"members_url"` + Parent GeneratedType_Nullable_team_simple `json:"parent"` // Groups of organization members that gives permissions on specified repositories. + Permission string `json:"permission"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Repositories_url string `json:"repositories_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Alert GeneratedType `json:"alert"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Repository_rule_file_extension_restriction represents the GeneratedType_Repository_rule_file_extension_restriction schema from the OpenAPI specification +type GeneratedType_Repository_rule_file_extension_restriction struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Members_url string `json:"members_url"` - Repos_url string `json:"repos_url"` - Avatar_url string `json:"avatar_url"` - Events_url string `json:"events_url"` - Node_id string `json:"node_id"` - Hooks_url string `json:"hooks_url"` - Login string `json:"login"` - Public_members_url string `json:"public_members_url"` - Description string `json:"description"` - Id int `json:"id"` - Issues_url string `json:"issues_url"` - Url string `json:"url"` +// GeneratedType_Webhook_gollum represents the GeneratedType_Webhook_gollum schema from the OpenAPI specification +type GeneratedType_Webhook_gollum struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pages []map[string]interface{} `json:"pages"` // The pages that were updated. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Language string `json:"language"` // The language of the CodeQL database. - Name string `json:"name"` // The name of the CodeQL database. - Commit_oid string `json:"commit_oid,omitempty"` // The commit SHA of the repository at the time the CodeQL database was created. - Content_type string `json:"content_type"` // The MIME type of the CodeQL database file. - Created_at string `json:"created_at"` // The date and time at which the CodeQL database was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Id int `json:"id"` // The ID of the CodeQL database. - Size int `json:"size"` // The size of the CodeQL database file in bytes. - Url string `json:"url"` // The URL at which to download the CodeQL database. The `Accept` header must be set to the value of the `content_type` property. - Updated_at string `json:"updated_at"` // The date and time at which the CodeQL database was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Uploader GeneratedType `json:"uploader"` // A GitHub user. +// GeneratedType_Codespaces_permissions_check_for_devcontainer represents the GeneratedType_Codespaces_permissions_check_for_devcontainer schema from the OpenAPI specification +type GeneratedType_Codespaces_permissions_check_for_devcontainer struct { + Accepted bool `json:"accepted"` // Whether the user has accepted the permissions defined by the devcontainer config } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` // The action that was performed. +// Webhooksprojectchanges represents the Webhooksprojectchanges schema from the OpenAPI specification +type Webhooksprojectchanges struct { + Archived_at map[string]interface{} `json:"archived_at,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_repository_renamed represents the GeneratedType_Webhook_repository_renamed schema from the OpenAPI specification +type GeneratedType_Webhook_repository_renamed struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue Webhooksissue2 `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Expire_at string `json:"expire_at,omitempty"` // The time that the bypass will expire in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Reason string `json:"reason,omitempty"` // The reason for bypassing push protection. - Token_type string `json:"token_type,omitempty"` // The token type this bypass is for. + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_dependabot_alert_auto_dismissed represents the GeneratedType_Webhook_dependabot_alert_auto_dismissed schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_auto_dismissed struct { + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_card Webhooksprojectcard `json:"project_card"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Comment map[string]interface{} `json:"comment"` // The [comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment) itself. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) the comment belongs to. +// Webhooksmembership represents the Webhooksmembership schema from the OpenAPI specification +type Webhooksmembership struct { + State string `json:"state"` + Url string `json:"url"` + User map[string]interface{} `json:"user"` + Organization_url string `json:"organization_url"` + Role string `json:"role"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Compute_service string `json:"compute_service,omitempty"` // The hosted compute service the network configuration supports. - Created_on string `json:"created_on"` // The time at which the network configuration was created, in ISO 8601 format. - Id string `json:"id"` // The unique identifier of the network configuration. - Name string `json:"name"` // The name of the network configuration. - Network_settings_ids []string `json:"network_settings_ids,omitempty"` // The unique identifier of each network settings in the configuration. +// Webhooksmilestone3 represents the Webhooksmilestone3 schema from the OpenAPI specification +type Webhooksmilestone3 struct { + Updated_at string `json:"updated_at"` + Creator map[string]interface{} `json:"creator"` + Closed_at string `json:"closed_at"` + Closed_issues int `json:"closed_issues"` + Url string `json:"url"` + Number int `json:"number"` // The number of the milestone. + Id int `json:"id"` + Open_issues int `json:"open_issues"` + State string `json:"state"` // The state of the milestone. + Description string `json:"description"` + Due_on string `json:"due_on"` + Node_id string `json:"node_id"` + Title string `json:"title"` // The title of the milestone. + Created_at string `json:"created_at"` + Html_url string `json:"html_url"` + Labels_url string `json:"labels_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id float64 `json:"id"` - Inherited bool `json:"inherited"` - Restricted_to_workflows bool `json:"restricted_to_workflows,omitempty"` // If `true`, the runner group will be restricted to running only the workflows specified in the `selected_workflows` array. - Hosted_runners_url string `json:"hosted_runners_url,omitempty"` - Workflow_restrictions_read_only bool `json:"workflow_restrictions_read_only,omitempty"` // If `true`, the `restricted_to_workflows` and `selected_workflows` fields cannot be modified. - Allows_public_repositories bool `json:"allows_public_repositories"` - Inherited_allows_public_repositories bool `json:"inherited_allows_public_repositories,omitempty"` - Network_configuration_id string `json:"network_configuration_id,omitempty"` // The identifier of a hosted compute network configuration. - Runners_url string `json:"runners_url"` - Name string `json:"name"` - Selected_repositories_url string `json:"selected_repositories_url,omitempty"` // Link to the selected repositories resource for this runner group. Not present unless visibility was set to `selected` - Selected_workflows []string `json:"selected_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless `restricted_to_workflows` is set to `true`. - Visibility string `json:"visibility"` - DefaultField bool `json:"default"` +// GeneratedType_Secret_scanning_location_issue_body represents the GeneratedType_Secret_scanning_location_issue_body schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_issue_body struct { + Issue_body_url string `json:"issue_body_url"` // The API URL to get the issue where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Pull_request map[string]interface{} `json:"pull_request"` - Reason string `json:"reason,omitempty"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_release_prereleased represents the GeneratedType_Webhook_release_prereleased schema from the OpenAPI specification +type GeneratedType_Webhook_release_prereleased struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Release map[string]interface{} `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Number int `json:"number"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_discussion_reopened represents the GeneratedType_Webhook_discussion_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_reopened struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Price_model string `json:"price_model"` - State string `json:"state"` - Accounts_url string `json:"accounts_url"` - Description string `json:"description"` - Monthly_price_in_cents int `json:"monthly_price_in_cents"` - Url string `json:"url"` - Yearly_price_in_cents int `json:"yearly_price_in_cents"` - Id int `json:"id"` - Has_free_trial bool `json:"has_free_trial"` - Number int `json:"number"` - Unit_name string `json:"unit_name"` - Bullets []string `json:"bullets"` - Name string `json:"name"` +// GeneratedType_Validation_error represents the GeneratedType_Validation_error schema from the OpenAPI specification +type GeneratedType_Validation_error struct { + Documentation_url string `json:"documentation_url"` + Errors []map[string]interface{} `json:"errors,omitempty"` + Message string `json:"message"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repositories_url string `json:"repositories_url"` // URL to the list of repositories requested to be accessed via fine-grained personal access token. Should only be followed when `repository_selection` is `subset`. - Token_id int `json:"token_id"` // Unique identifier of the user's token. This field can also be found in audit log events and the organization's settings for their PAT grants. - Permissions map[string]interface{} `json:"permissions"` // Permissions requested, categorized by type of permission. - Reason string `json:"reason"` // Reason for requesting access. - Token_name string `json:"token_name"` // The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. - Id int `json:"id"` // Unique identifier of the request for access via fine-grained personal access token. The `pat_request_id` used to review PAT requests. - Repository_selection string `json:"repository_selection"` // Type of repository selection requested. - Created_at string `json:"created_at"` // Date and time when the request for access was created. - Owner GeneratedType `json:"owner"` // A GitHub user. - Token_expired bool `json:"token_expired"` // Whether the associated fine-grained personal access token has expired. - Token_expires_at string `json:"token_expires_at"` // Date and time when the associated fine-grained personal access token expires. - Token_last_used_at string `json:"token_last_used_at"` // Date and time when the associated fine-grained personal access token was last used for authentication. +// GeneratedType_Webhook_check_run_rerequested represents the GeneratedType_Webhook_check_run_rerequested schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_rerequested struct { + Action string `json:"action,omitempty"` + Check_run GeneratedType_Check_run_with_simple_check_suite `json:"check_run"` // A check performed on the code of a given code change + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Forkee interface{} `json:"forkee"` // The created [`repository`](https://docs.github.com/rest/repos/repos#get-a-repository) resource. +// Discussion represents the Discussion schema from the OpenAPI specification +type Discussion struct { + Comments int `json:"comments"` + Id int `json:"id"` + State string `json:"state"` // The current state of the discussion. `converting` means that the discussion is being converted from an issue. `transferring` means that the discussion is being transferred from another repository. + Active_lock_reason string `json:"active_lock_reason"` + Answer_chosen_by map[string]interface{} `json:"answer_chosen_by"` + Created_at string `json:"created_at"` + Node_id string `json:"node_id"` + Updated_at string `json:"updated_at"` + Html_url string `json:"html_url"` + Answer_chosen_at string `json:"answer_chosen_at"` + Answer_html_url string `json:"answer_html_url"` + State_reason string `json:"state_reason"` // The reason for the current state + Timeline_url string `json:"timeline_url,omitempty"` + User map[string]interface{} `json:"user"` + Body string `json:"body"` + Labels []Label `json:"labels,omitempty"` + Locked bool `json:"locked"` + Category map[string]interface{} `json:"category"` + Number int `json:"number"` + Reactions map[string]interface{} `json:"reactions,omitempty"` + Repository_url string `json:"repository_url"` + Title string `json:"title"` + Author_association string `json:"author_association"` // How the author is associated with the repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Starred_url string `json:"starred_url"` - User_view_type string `json:"user_view_type,omitempty"` - Repos_url string `json:"repos_url"` - Organizations_url string `json:"organizations_url"` - Url string `json:"url"` - Email string `json:"email,omitempty"` - Following_url string `json:"following_url"` - Html_url string `json:"html_url"` - Events_url string `json:"events_url"` - Role_name string `json:"role_name"` - TypeField string `json:"type"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Subscriptions_url string `json:"subscriptions_url"` - Avatar_url string `json:"avatar_url"` - Followers_url string `json:"followers_url"` - Gists_url string `json:"gists_url"` - Name string `json:"name,omitempty"` - Node_id string `json:"node_id"` - Received_events_url string `json:"received_events_url"` - Gravatar_id string `json:"gravatar_id"` - Id int64 `json:"id"` - Site_admin bool `json:"site_admin"` - Login string `json:"login"` +// GeneratedType_Branch_short represents the GeneratedType_Branch_short schema from the OpenAPI specification +type GeneratedType_Branch_short struct { + Protected bool `json:"protected"` + Commit map[string]interface{} `json:"commit"` + Name string `json:"name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Marketplace_purchase map[string]interface{} `json:"marketplace_purchase"` - Organization_billing_email string `json:"organization_billing_email,omitempty"` - TypeField string `json:"type"` - Url string `json:"url"` - Email string `json:"email,omitempty"` - Id int `json:"id"` - Login string `json:"login"` - Marketplace_pending_change map[string]interface{} `json:"marketplace_pending_change,omitempty"` +// GeneratedType_Actions_hosted_runner_machine_spec represents the GeneratedType_Actions_hosted_runner_machine_spec schema from the OpenAPI specification +type GeneratedType_Actions_hosted_runner_machine_spec struct { + Id string `json:"id"` // The ID used for the `size` parameter when creating a new runner. + Memory_gb int `json:"memory_gb"` // The available RAM for the machine spec. + Storage_gb int `json:"storage_gb"` // The available SSD storage for the machine spec. + Cpu_cores int `json:"cpu_cores"` // The number of cores. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Merge_method string `json:"merge_method"` // The merge method to use. - Commit_message string `json:"commit_message"` // Commit message for the merge commit. - Commit_title string `json:"commit_title"` // Title for the merge commit message. - Enabled_by GeneratedType `json:"enabled_by"` // A GitHub user. +// GeneratedType_Webhook_dependabot_alert_reopened represents the GeneratedType_Webhook_dependabot_alert_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_reopened struct { + Action string `json:"action"` + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Webhook_ping represents the GeneratedType_Webhook_ping schema from the OpenAPI specification +type GeneratedType_Webhook_ping struct { + Hook map[string]interface{} `json:"hook,omitempty"` // The webhook that is being pinged + Hook_id int `json:"hook_id,omitempty"` // The ID of the webhook that triggered the ping. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Zen string `json:"zen,omitempty"` // Random string of GitHub zen. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// Webhooksreview represents the Webhooksreview schema from the OpenAPI specification +type Webhooksreview struct { + Id int `json:"id"` // Unique identifier of the review + State string `json:"state"` + User map[string]interface{} `json:"user"` + Body string `json:"body"` // The text of the review. + Commit_id string `json:"commit_id"` // A commit SHA for the review. + Node_id string `json:"node_id"` + Html_url string `json:"html_url"` + Pull_request_url string `json:"pull_request_url"` + Submitted_at string `json:"submitted_at"` + Links map[string]interface{} `json:"_links"` + Author_association string `json:"author_association"` // How the author is associated with the repository. } -// Label represents the Label schema from the OpenAPI specification -type Label struct { - Id int64 `json:"id"` // Unique identifier for the label. - Name string `json:"name"` // The name of the label. - Node_id string `json:"node_id"` - Url string `json:"url"` // URL for the label - Color string `json:"color"` // 6-character hex code, without the leading #, identifying the color - DefaultField bool `json:"default"` // Whether this label comes by default in a new repository. - Description string `json:"description"` // Optional description of the label, such as its purpose. +// GeneratedType_Organization_actions_secret represents the GeneratedType_Organization_actions_secret schema from the OpenAPI specification +type GeneratedType_Organization_actions_secret struct { + Created_at string `json:"created_at"` + Name string `json:"name"` // The name of the secret. + Selected_repositories_url string `json:"selected_repositories_url,omitempty"` + Updated_at string `json:"updated_at"` + Visibility string `json:"visibility"` // Visibility of a secret } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_member_removed represents the GeneratedType_Webhook_member_removed schema from the OpenAPI specification +type GeneratedType_Webhook_member_removed struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project Webhooksproject `json:"project"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Member Webhooksuser `json:"member"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +} + +// GeneratedType_Sub_issues_summary represents the GeneratedType_Sub_issues_summary schema from the OpenAPI specification +type GeneratedType_Sub_issues_summary struct { + Percent_completed int `json:"percent_completed"` + Total int `json:"total"` + Completed int `json:"completed"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_workflow_job_completed represents the GeneratedType_Webhook_workflow_job_completed schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_job_completed struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow_job interface{} `json:"workflow_job"` Action string `json:"action"` - Answer Webhooksanswer `json:"answer"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Can_approve_pull_request_reviews bool `json:"can_approve_pull_request_reviews,omitempty"` // Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. - Default_workflow_permissions string `json:"default_workflow_permissions,omitempty"` // The default workflow permissions granted to the GITHUB_TOKEN when running workflows. +// GeneratedType_Starred_repository represents the GeneratedType_Starred_repository schema from the OpenAPI specification +type GeneratedType_Starred_repository struct { + Starred_at string `json:"starred_at"` + Repo Repository `json:"repo"` // A repository on GitHub. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Milestone Webhooksmilestone3 `json:"milestone"` // A collection of related issues and pull requests. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// Runner represents the Runner schema from the OpenAPI specification +type Runner struct { + Id int `json:"id"` // The ID of the runner. + Labels []GeneratedType_Runner_label `json:"labels"` + Name string `json:"name"` // The name of the runner. + Os string `json:"os"` // The Operating System of the runner. + Runner_group_id int `json:"runner_group_id,omitempty"` // The ID of the runner group. + Status string `json:"status"` // The status of the runner. + Busy bool `json:"busy"` + Ephemeral bool `json:"ephemeral,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Actor GeneratedType `json:"actor"` // A GitHub user. +// GeneratedType_Issue_event_project_card represents the GeneratedType_Issue_event_project_card schema from the OpenAPI specification +type GeneratedType_Issue_event_project_card struct { Url string `json:"url"` - Commit_id string `json:"commit_id"` - Commit_url string `json:"commit_url"` - Event string `json:"event"` + Column_name string `json:"column_name"` Id int `json:"id"` - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Created_at string `json:"created_at"` - Node_id string `json:"node_id"` + Previous_column_name string `json:"previous_column_name,omitempty"` + Project_id int `json:"project_id"` + Project_url string `json:"project_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Security_advisory map[string]interface{} `json:"security_advisory"` // The details of the security advisory, including summary, description, and severity. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Code_scanning_alert_instance represents the GeneratedType_Code_scanning_alert_instance schema from the OpenAPI specification +type GeneratedType_Code_scanning_alert_instance struct { + Environment string `json:"environment,omitempty"` // Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed. + State string `json:"state,omitempty"` // State of a code scanning alert. + Analysis_key string `json:"analysis_key,omitempty"` // Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. + Category string `json:"category,omitempty"` // Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code. + Classifications []string `json:"classifications,omitempty"` // Classifications that have been applied to the file that triggered the alert. For example identifying it as documentation, or a generated file. + Location GeneratedType_Code_scanning_alert_location `json:"location,omitempty"` // Describe a region within a file for the alert. + Ref string `json:"ref,omitempty"` // The Git reference, formatted as `refs/pull//merge`, `refs/pull//head`, `refs/heads/` or simply ``. + Commit_sha string `json:"commit_sha,omitempty"` + Html_url string `json:"html_url,omitempty"` + Message map[string]interface{} `json:"message,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_member_added represents the GeneratedType_Webhook_member_added schema from the OpenAPI specification +type GeneratedType_Webhook_member_added struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Deployment map[string]interface{} `json:"deployment"` // The [deployment](https://docs.github.com/rest/deployments/deployments#list-deployments). - Deployment_status map[string]interface{} `json:"deployment_status"` // The [deployment status](https://docs.github.com/rest/deployments/statuses#list-deployment-statuses). - Workflow Webhooksworkflow `json:"workflow,omitempty"` - Check_run map[string]interface{} `json:"check_run,omitempty"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_run map[string]interface{} `json:"workflow_run,omitempty"` + Changes map[string]interface{} `json:"changes,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Member Webhooksuser `json:"member"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_branch_protection_rule_deleted represents the GeneratedType_Webhook_branch_protection_rule_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_branch_protection_rule_deleted struct { Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Sender GeneratedType `json:"sender"` // A GitHub user. - Label Webhookslabel `json:"label,omitempty"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Rule Webhooksrule `json:"rule"` // The branch protection rule. Includes a `name` and all the [branch protection settings](https://docs.github.com/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-settings) applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of `off`, `non_admins`, or `everyone`. Actor and build lists are arrays of strings. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// Commit represents the Commit schema from the OpenAPI specification -type Commit struct { - Commit map[string]interface{} `json:"commit"` - Html_url string `json:"html_url"` - Author interface{} `json:"author"` - Committer interface{} `json:"committer"` - Files []GeneratedType `json:"files,omitempty"` +// GeneratedType_Projects_v2_status_update represents the GeneratedType_Projects_v2_status_update schema from the OpenAPI specification +type GeneratedType_Projects_v2_status_update struct { + Updated_at string `json:"updated_at"` Node_id string `json:"node_id"` - Parents []map[string]interface{} `json:"parents"` - Sha string `json:"sha"` - Stats map[string]interface{} `json:"stats,omitempty"` - Url string `json:"url"` - Comments_url string `json:"comments_url"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Label Webhookslabel `json:"label"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Filename string `json:"filename"` - Raw_url string `json:"raw_url"` - Deletions int `json:"deletions"` - Previous_filename string `json:"previous_filename,omitempty"` - Changes int `json:"changes"` - Patch string `json:"patch,omitempty"` - Sha string `json:"sha"` - Status string `json:"status"` - Contents_url string `json:"contents_url"` - Additions int `json:"additions"` - Blob_url string `json:"blob_url"` -} - -// Webhookschanges8 represents the Webhookschanges8 schema from the OpenAPI specification -type Webhookschanges8 struct { - Tier map[string]interface{} `json:"tier"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Event string `json:"event"` - Project_card map[string]interface{} `json:"project_card,omitempty"` - Commit_id string `json:"commit_id"` + Status string `json:"status,omitempty"` + Target_date string `json:"target_date,omitempty"` + Project_node_id string `json:"project_node_id,omitempty"` + Start_date string `json:"start_date,omitempty"` + Body string `json:"body,omitempty"` // Body of the status update Created_at string `json:"created_at"` - Node_id string `json:"node_id"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Id int `json:"id"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Commit_url string `json:"commit_url"` - Url string `json:"url"` + Creator GeneratedType_Simple_user `json:"creator,omitempty"` // A GitHub user. + Id float64 `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` +// GeneratedType_Simple_installation represents the GeneratedType_Simple_installation schema from the OpenAPI specification +type GeneratedType_Simple_installation struct { + Id int `json:"id"` // The ID of the installation. + Node_id string `json:"node_id"` // The global node ID of the installation. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Started_at string `json:"started_at"` // The start time of an autofix in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Status string `json:"status"` // The status of an autofix. - Description string `json:"description"` // The description of an autofix. +// GeneratedType_Basic_error represents the GeneratedType_Basic_error schema from the OpenAPI specification +type GeneratedType_Basic_error struct { + Documentation_url string `json:"documentation_url,omitempty"` + Message string `json:"message,omitempty"` + Status string `json:"status,omitempty"` + Url string `json:"url,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_installation_repositories_removed represents the GeneratedType_Webhook_installation_repositories_removed schema from the OpenAPI specification +type GeneratedType_Webhook_installation_repositories_removed struct { + Repositories_added []map[string]interface{} `json:"repositories_added"` // An array of repository objects, which were added to the installation. + Repositories_removed []map[string]interface{} `json:"repositories_removed"` // An array of repository objects, which were removed from the installation. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved + Requester Webhooksuser `json:"requester"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation Installation `json:"installation"` // Installation + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actions_workflow_run_id int `json:"actions_workflow_run_id,omitempty"` // The GitHub Actions workflow run used to execute this variant analysis. This is only available if the workflow run has started. - Controller_repo GeneratedType `json:"controller_repo"` // A GitHub repository. - Updated_at string `json:"updated_at,omitempty"` // The date and time at which the variant analysis was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Created_at string `json:"created_at,omitempty"` // The date and time at which the variant analysis was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Skipped_repositories map[string]interface{} `json:"skipped_repositories,omitempty"` // Information about repositories that were skipped from processing. This information is only available to the user that initiated the variant analysis. - Status string `json:"status"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Id int `json:"id"` // The ID of the variant analysis. - Completed_at string `json:"completed_at,omitempty"` // The date and time at which the variant analysis was completed, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. Will be null if the variant analysis has not yet completed or this information is not available. - Failure_reason string `json:"failure_reason,omitempty"` // The reason for a failure of the variant analysis. This is only available if the variant analysis has failed. - Query_language string `json:"query_language"` // The language targeted by the CodeQL query - Query_pack_url string `json:"query_pack_url"` // The download url for the query pack. - Scanned_repositories []map[string]interface{} `json:"scanned_repositories,omitempty"` +// GeneratedType_Issue_event_dismissed_review represents the GeneratedType_Issue_event_dismissed_review schema from the OpenAPI specification +type GeneratedType_Issue_event_dismissed_review struct { + Review_id int `json:"review_id"` + State string `json:"state"` + Dismissal_commit_id string `json:"dismissal_commit_id,omitempty"` + Dismissal_message string `json:"dismissal_message"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sbom map[string]interface{} `json:"sbom"` +// Webhooksworkflow represents the Webhooksworkflow schema from the OpenAPI specification +type Webhooksworkflow struct { + Created_at string `json:"created_at"` + Name string `json:"name"` + Node_id string `json:"node_id"` + Path string `json:"path"` + State string `json:"state"` + Updated_at string `json:"updated_at"` + Url string `json:"url"` + Badge_url string `json:"badge_url"` + Html_url string `json:"html_url"` + Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Billable map[string]interface{} `json:"billable"` +// GeneratedType_Issue_event represents the GeneratedType_Issue_event schema from the OpenAPI specification +type GeneratedType_Issue_event struct { + Actor GeneratedType_Nullable_simple_user `json:"actor"` // A GitHub user. + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Assignee GeneratedType_Nullable_simple_user `json:"assignee,omitempty"` // A GitHub user. + Author_association string `json:"author_association,omitempty"` // How the author is associated with the repository. + Created_at string `json:"created_at"` + Milestone GeneratedType_Issue_event_milestone `json:"milestone,omitempty"` // Issue Event Milestone + Commit_id string `json:"commit_id"` + Url string `json:"url"` + Event string `json:"event"` + Requested_team Team `json:"requested_team,omitempty"` // Groups of organization members that gives permissions on specified repositories. + Dismissed_review GeneratedType_Issue_event_dismissed_review `json:"dismissed_review,omitempty"` + Issue GeneratedType_Nullable_issue `json:"issue,omitempty"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Project_card GeneratedType_Issue_event_project_card `json:"project_card,omitempty"` // Issue Event Project Card + Id int64 `json:"id"` + Assigner GeneratedType_Nullable_simple_user `json:"assigner,omitempty"` // A GitHub user. + Node_id string `json:"node_id"` + Review_requester GeneratedType_Nullable_simple_user `json:"review_requester,omitempty"` // A GitHub user. + Label GeneratedType_Issue_event_label `json:"label,omitempty"` // Issue Event Label + Lock_reason string `json:"lock_reason,omitempty"` + Requested_reviewer GeneratedType_Nullable_simple_user `json:"requested_reviewer,omitempty"` // A GitHub user. + Rename GeneratedType_Issue_event_rename `json:"rename,omitempty"` // Issue Event Rename + Commit_url string `json:"commit_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Label Webhookslabel `json:"label,omitempty"` - Number int `json:"number"` // The pull request number. - Pull_request map[string]interface{} `json:"pull_request"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Action string `json:"action"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Code_scanning_alert represents the GeneratedType_Code_scanning_alert schema from the OpenAPI specification +type GeneratedType_Code_scanning_alert struct { + Fixed_at string `json:"fixed_at,omitempty"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Rule GeneratedType_Code_scanning_alert_rule `json:"rule"` + Dismissed_by GeneratedType_Nullable_simple_user `json:"dismissed_by"` // A GitHub user. + Number int `json:"number"` // The security alert number. + Dismissal_approved_by GeneratedType_Nullable_simple_user `json:"dismissal_approved_by,omitempty"` // A GitHub user. + Html_url string `json:"html_url"` // The GitHub URL of the alert resource. + Tool GeneratedType_Code_scanning_analysis_tool `json:"tool"` + State string `json:"state"` // State of a code scanning alert. + Url string `json:"url"` // The REST API URL of the alert resource. + Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Instances_url string `json:"instances_url"` // The REST API URL for fetching the list of instances for an alert. + Most_recent_instance GeneratedType_Code_scanning_alert_instance `json:"most_recent_instance"` + Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_reason string `json:"dismissed_reason"` // **Required when the state is dismissed.** The reason for dismissing or closing the alert. + Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_comment string `json:"dismissed_comment,omitempty"` // The dismissal comment associated with the dismissal of the alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action,omitempty"` - Check_run GeneratedType `json:"check_run"` // A check performed on the code of a given code change - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Secret_scanning_scan_history represents the GeneratedType_Secret_scanning_scan_history schema from the OpenAPI specification +type GeneratedType_Secret_scanning_scan_history struct { + Backfill_scans []GeneratedType_Secret_scanning_scan `json:"backfill_scans,omitempty"` + Custom_pattern_backfill_scans []interface{} `json:"custom_pattern_backfill_scans,omitempty"` + Incremental_scans []GeneratedType_Secret_scanning_scan `json:"incremental_scans,omitempty"` + Pattern_update_scans []GeneratedType_Secret_scanning_scan `json:"pattern_update_scans,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Run_attempt int `json:"run_attempt,omitempty"` // Attempt number of the run, 1 for first attempt and higher if the workflow was re-run. - Path string `json:"path"` // The full path of the workflow +// Integration represents the Integration schema from the OpenAPI specification +type Integration struct { + Description string `json:"description"` + Events []string `json:"events"` // The list of events for the GitHub app. Note that the `installation_target`, `security_advisory`, and `meta` events are not included because they are global events and not specific to an installation. Html_url string `json:"html_url"` - Name string `json:"name,omitempty"` // The name of the workflow run. - Jobs_url string `json:"jobs_url"` // The URL to the jobs for the workflow run. - Conclusion string `json:"conclusion"` - Head_repository_id int `json:"head_repository_id,omitempty"` - Artifacts_url string `json:"artifacts_url"` // The URL to the artifacts for the workflow run. - Created_at string `json:"created_at"` - Check_suite_node_id string `json:"check_suite_node_id,omitempty"` // The node ID of the associated check suite. - Run_started_at string `json:"run_started_at,omitempty"` // The start time of the latest run. Resets on re-run. - Actor GeneratedType `json:"actor,omitempty"` // A GitHub user. - Repository GeneratedType `json:"repository"` // Minimal Repository - Head_repository GeneratedType `json:"head_repository"` // Minimal Repository - Id int `json:"id"` // The ID of the workflow run. - Rerun_url string `json:"rerun_url"` // The URL to rerun the workflow run. - Status string `json:"status"` - Head_commit GeneratedType `json:"head_commit"` // A commit. - Check_suite_url string `json:"check_suite_url"` // The URL to the associated check suite. - Display_title string `json:"display_title"` // The event-specific title associated with the run or the run-name if set, or the value of `run-name` if it is set in the workflow. - Referenced_workflows []GeneratedType `json:"referenced_workflows,omitempty"` - Workflow_url string `json:"workflow_url"` // The URL to the workflow. - Triggering_actor GeneratedType `json:"triggering_actor,omitempty"` // A GitHub user. - Logs_url string `json:"logs_url"` // The URL to download the logs for the workflow run. - Workflow_id int `json:"workflow_id"` // The ID of the parent workflow. - Cancel_url string `json:"cancel_url"` // The URL to cancel the workflow run. - Check_suite_id int `json:"check_suite_id,omitempty"` // The ID of the associated check suite. - Previous_attempt_url string `json:"previous_attempt_url,omitempty"` // The URL to the previous attempted run of this workflow, if one exists. - Url string `json:"url"` // The URL to the workflow run. - Pull_requests []GeneratedType `json:"pull_requests"` // Pull requests that are open with a `head_sha` or `head_branch` that matches the workflow run. The returned pull requests do not necessarily indicate pull requests that triggered the run. - Event string `json:"event"` + Installations_count int `json:"installations_count,omitempty"` // The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself. + Owner interface{} `json:"owner"` + Client_id string `json:"client_id,omitempty"` + Id int `json:"id"` // Unique identifier of the GitHub app + External_url string `json:"external_url"` + Name string `json:"name"` // The name of the GitHub app Node_id string `json:"node_id"` - Run_number int `json:"run_number"` // The auto incrementing run number for the workflow run. - Head_sha string `json:"head_sha"` // The SHA of the head commit that points to the version of the workflow being run. + Permissions map[string]interface{} `json:"permissions"` // The set of permissions for the GitHub app + Slug string `json:"slug,omitempty"` // The slug name of the GitHub app Updated_at string `json:"updated_at"` - Head_branch string `json:"head_branch"` + Created_at string `json:"created_at"` } -// Webhooksalert represents the Webhooksalert schema from the OpenAPI specification -type Webhooksalert struct { - Id int `json:"id"` - Dismissed_at string `json:"dismissed_at,omitempty"` - Ghsa_id string `json:"ghsa_id"` - Dismiss_reason string `json:"dismiss_reason,omitempty"` - External_reference string `json:"external_reference"` - Dismisser map[string]interface{} `json:"dismisser,omitempty"` - Severity string `json:"severity"` - Fixed_at string `json:"fixed_at,omitempty"` - External_identifier string `json:"external_identifier"` - Affected_range string `json:"affected_range"` - Node_id string `json:"node_id"` - Affected_package_name string `json:"affected_package_name"` - Fix_reason string `json:"fix_reason,omitempty"` - State string `json:"state"` - Fixed_in string `json:"fixed_in,omitempty"` - Number int `json:"number"` - Created_at string `json:"created_at"` +// Feed represents the Feed schema from the OpenAPI specification +type Feed struct { + Current_user_organization_urls []string `json:"current_user_organization_urls,omitempty"` + Repository_discussions_category_url string `json:"repository_discussions_category_url,omitempty"` // A feed of discussions for a given repository and category. + User_url string `json:"user_url"` + Current_user_organization_url string `json:"current_user_organization_url,omitempty"` + Current_user_public_url string `json:"current_user_public_url,omitempty"` + Current_user_url string `json:"current_user_url,omitempty"` + Links map[string]interface{} `json:"_links"` + Repository_discussions_url string `json:"repository_discussions_url,omitempty"` // A feed of discussions for a given repository. + Security_advisories_url string `json:"security_advisories_url,omitempty"` + Timeline_url string `json:"timeline_url"` + Current_user_actor_url string `json:"current_user_actor_url,omitempty"` } -// Release represents the Release schema from the OpenAPI specification -type Release struct { - Draft bool `json:"draft"` // true to create a draft (unpublished) release, false to create a published one. - Upload_url string `json:"upload_url"` - Prerelease bool `json:"prerelease"` // Whether to identify the release as a prerelease or a full release. - Assets []GeneratedType `json:"assets"` - Body_html string `json:"body_html,omitempty"` - Mentions_count int `json:"mentions_count,omitempty"` - Html_url string `json:"html_url"` - Name string `json:"name"` - Body string `json:"body,omitempty"` +// GeneratedType_Code_security_configuration_for_repository represents the GeneratedType_Code_security_configuration_for_repository schema from the OpenAPI specification +type GeneratedType_Code_security_configuration_for_repository struct { + Configuration GeneratedType_Code_security_configuration `json:"configuration,omitempty"` // A code security configuration + Status string `json:"status,omitempty"` // The attachment status of the code security configuration on the repository. +} + +// Root represents the Root schema from the OpenAPI specification +type Root struct { + Events_url string `json:"events_url"` + Organization_url string `json:"organization_url"` + Starred_gists_url string `json:"starred_gists_url"` + Current_user_url string `json:"current_user_url"` + Emails_url string `json:"emails_url"` + Commit_search_url string `json:"commit_search_url"` + Current_user_repositories_url string `json:"current_user_repositories_url"` + Keys_url string `json:"keys_url"` + Gists_url string `json:"gists_url"` + Issues_url string `json:"issues_url"` + Feeds_url string `json:"feeds_url"` + Hub_url string `json:"hub_url,omitempty"` + Repository_search_url string `json:"repository_search_url"` + Emojis_url string `json:"emojis_url"` + Organization_teams_url string `json:"organization_teams_url"` + Public_gists_url string `json:"public_gists_url"` + Topic_search_url string `json:"topic_search_url,omitempty"` + Rate_limit_url string `json:"rate_limit_url"` + Organization_repositories_url string `json:"organization_repositories_url"` + Followers_url string `json:"followers_url"` + User_organizations_url string `json:"user_organizations_url"` + Notifications_url string `json:"notifications_url"` + Starred_url string `json:"starred_url"` + Authorizations_url string `json:"authorizations_url"` + Code_search_url string `json:"code_search_url"` + Current_user_authorizations_html_url string `json:"current_user_authorizations_html_url"` + User_search_url string `json:"user_search_url"` + User_repositories_url string `json:"user_repositories_url"` + Repository_url string `json:"repository_url"` + User_url string `json:"user_url"` + Following_url string `json:"following_url"` + Issue_search_url string `json:"issue_search_url"` + Label_search_url string `json:"label_search_url"` +} + +// GeneratedType_Label_search_result_item represents the GeneratedType_Label_search_result_item schema from the OpenAPI specification +type GeneratedType_Label_search_result_item struct { + DefaultField bool `json:"default"` Id int `json:"id"` + Name string `json:"name"` + Score float64 `json:"score"` + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` + Color string `json:"color"` + Description string `json:"description"` Node_id string `json:"node_id"` - Tarball_url string `json:"tarball_url"` Url string `json:"url"` - Published_at string `json:"published_at"` - Target_commitish string `json:"target_commitish"` // Specifies the commitish value that determines where the Git tag is created from. - Zipball_url string `json:"zipball_url"` - Reactions GeneratedType `json:"reactions,omitempty"` - Assets_url string `json:"assets_url"` - Author GeneratedType `json:"author"` // A GitHub user. - Discussion_url string `json:"discussion_url,omitempty"` // The URL of the release discussion. - Body_text string `json:"body_text,omitempty"` - Tag_name string `json:"tag_name"` // The name of the tag. - Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Check_automated_security_fixes represents the GeneratedType_Check_automated_security_fixes schema from the OpenAPI specification +type GeneratedType_Check_automated_security_fixes struct { + Enabled bool `json:"enabled"` // Whether Dependabot security updates are enabled for the repository. + Paused bool `json:"paused"` // Whether Dependabot security updates are paused for the repository. +} + +// GeneratedType_Webhook_organization_deleted represents the GeneratedType_Webhook_organization_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_organization_deleted struct { + Membership Webhooksmembership `json:"membership,omitempty"` // The membership between the user and the organization. Not present when the action is `member_invited`. + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Comment Webhooksreviewcomment `json:"comment"` // The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Published_at string `json:"published_at,omitempty"` // The date and time the campaign was published, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - State string `json:"state"` // Indicates whether a campaign is open or closed - Ends_at string `json:"ends_at"` // The date and time the campaign has ended, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Managers []GeneratedType `json:"managers"` // The campaign managers - Updated_at string `json:"updated_at"` // The date and time the campaign was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Alert_stats map[string]interface{} `json:"alert_stats,omitempty"` - Contact_link string `json:"contact_link"` // The contact link of the campaign. - Closed_at string `json:"closed_at,omitempty"` // The date and time the campaign was closed, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. Will be null if the campaign is still open. - Number int `json:"number"` // The number of the newly created campaign - Team_managers []Team `json:"team_managers,omitempty"` // The campaign team managers - Created_at string `json:"created_at"` // The date and time the campaign was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Description string `json:"description"` // The campaign description - Name string `json:"name,omitempty"` // The campaign name +// GeneratedType_Billing_usage_report represents the GeneratedType_Billing_usage_report schema from the OpenAPI specification +type GeneratedType_Billing_usage_report struct { + Usageitems []map[string]interface{} `json:"usageItems,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repos_url string `json:"repos_url"` - Url string `json:"url"` - Id int `json:"id"` +// GeneratedType_Nullable_simple_user represents the GeneratedType_Nullable_simple_user schema from the OpenAPI specification +type GeneratedType_Nullable_simple_user struct { + Avatar_url string `json:"avatar_url"` + Email string `json:"email,omitempty"` + Gists_url string `json:"gists_url"` Login string `json:"login"` - Issues_url string `json:"issues_url"` - Members_url string `json:"members_url"` - Public_members_url string `json:"public_members_url"` + Gravatar_id string `json:"gravatar_id"` + Site_admin bool `json:"site_admin"` + Starred_at string `json:"starred_at,omitempty"` + Subscriptions_url string `json:"subscriptions_url"` + Followers_url string `json:"followers_url"` + Url string `json:"url"` + User_view_type string `json:"user_view_type,omitempty"` Events_url string `json:"events_url"` - Hooks_url string `json:"hooks_url"` + Id int64 `json:"id"` Node_id string `json:"node_id"` - Avatar_url string `json:"avatar_url"` - Description string `json:"description"` + Organizations_url string `json:"organizations_url"` + Starred_url string `json:"starred_url"` + Following_url string `json:"following_url"` + Html_url string `json:"html_url"` + Received_events_url string `json:"received_events_url"` + Name string `json:"name,omitempty"` + Repos_url string `json:"repos_url"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url"` // The API URL for the advisory. - Identifiers []map[string]interface{} `json:"identifiers"` - References []string `json:"references"` - Vulnerabilities []Vulnerability `json:"vulnerabilities"` // The products and respective version ranges affected by the advisory. - Cvss map[string]interface{} `json:"cvss"` - Cwes []map[string]interface{} `json:"cwes"` - Github_reviewed_at string `json:"github_reviewed_at"` // The date and time of when the advisory was reviewed by GitHub, in ISO 8601 format. - Published_at string `json:"published_at"` // The date and time of when the advisory was published, in ISO 8601 format. - Cvss_severities GeneratedType `json:"cvss_severities,omitempty"` - Description string `json:"description"` // A detailed description of what the advisory entails. - Epss GeneratedType `json:"epss,omitempty"` // The EPSS scores as calculated by the [Exploit Prediction Scoring System](https://www.first.org/epss). - Updated_at string `json:"updated_at"` // The date and time of when the advisory was last updated, in ISO 8601 format. - TypeField string `json:"type"` // The type of advisory. - Withdrawn_at string `json:"withdrawn_at"` // The date and time of when the advisory was withdrawn, in ISO 8601 format. - Source_code_location string `json:"source_code_location"` // The URL of the advisory's source code. - Credits []map[string]interface{} `json:"credits"` // The users who contributed to the advisory. - Summary string `json:"summary"` // A short summary of the advisory. - Ghsa_id string `json:"ghsa_id"` // The GitHub Security Advisory ID. - Cve_id string `json:"cve_id"` // The Common Vulnerabilities and Exposures (CVE) ID. - Repository_advisory_url string `json:"repository_advisory_url"` // The API URL for the repository advisory. - Html_url string `json:"html_url"` // The URL for the advisory. - Nvd_published_at string `json:"nvd_published_at"` // The date and time when the advisory was published in the National Vulnerability Database, in ISO 8601 format. This field is only populated when the advisory is imported from the National Vulnerability Database. - Severity string `json:"severity"` // The severity of the advisory. +// GeneratedType_Organization_programmatic_access_grant represents the GeneratedType_Organization_programmatic_access_grant schema from the OpenAPI specification +type GeneratedType_Organization_programmatic_access_grant struct { + Access_granted_at string `json:"access_granted_at"` // Date and time when the fine-grained personal access token was approved to access the organization. + Token_last_used_at string `json:"token_last_used_at"` // Date and time when the associated fine-grained personal access token was last used for authentication. + Repository_selection string `json:"repository_selection"` // Type of repository selection requested. + Token_expired bool `json:"token_expired"` // Whether the associated fine-grained personal access token has expired. + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Repositories_url string `json:"repositories_url"` // URL to the list of repositories the fine-grained personal access token can access. Only follow when `repository_selection` is `subset`. + Token_id int `json:"token_id"` // Unique identifier of the user's token. This field can also be found in audit log events and the organization's settings for their PAT grants. + Id int `json:"id"` // Unique identifier of the fine-grained personal access token grant. The `pat_id` used to get details about an approved fine-grained personal access token. + Permissions map[string]interface{} `json:"permissions"` // Permissions requested, categorized by type of permission. + Token_expires_at string `json:"token_expires_at"` // Date and time when the associated fine-grained personal access token expires. + Token_name string `json:"token_name"` // The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` // A unique identifier of the repository. - Node_id string `json:"node_id"` // The GraphQL identifier of the repository. - Private bool `json:"private"` // Whether the repository is private. - Default_branch string `json:"default_branch"` // The default branch for the repository. - Full_name string `json:"full_name"` // The full, globally unique name of the repository. - Html_url string `json:"html_url"` // The URL to view the repository on GitHub.com. +// GeneratedType_Repository_rule_violation_error represents the GeneratedType_Repository_rule_violation_error schema from the OpenAPI specification +type GeneratedType_Repository_rule_violation_error struct { + Documentation_url string `json:"documentation_url,omitempty"` + Message string `json:"message,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Status string `json:"status,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. - Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. - Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Sub_issue_repo Repository `json:"sub_issue_repo"` // A repository on GitHub. - Action string `json:"action"` +// GeneratedType_Code_security_configuration_repositories represents the GeneratedType_Code_security_configuration_repositories schema from the OpenAPI specification +type GeneratedType_Code_security_configuration_repositories struct { + Repository GeneratedType_Simple_repository `json:"repository,omitempty"` // A GitHub repository. + Status string `json:"status,omitempty"` // The attachment status of the code security configuration on the repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Editors []map[string]interface{} `json:"editors,omitempty"` - Languages []map[string]interface{} `json:"languages,omitempty"` // Code completion metrics for active languages. - Total_engaged_users int `json:"total_engaged_users,omitempty"` // Number of users who accepted at least one Copilot code suggestion, across all active editors. Includes both full and partial acceptances. +// GeneratedType_Repository_rule_params_restricted_commits represents the GeneratedType_Repository_rule_params_restricted_commits schema from the OpenAPI specification +type GeneratedType_Repository_rule_params_restricted_commits struct { + Oid string `json:"oid"` // Full or abbreviated commit hash to reject + Reason string `json:"reason,omitempty"` // Reason for restriction } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Membership Webhooksmembership `json:"membership"` // The membership between the user and the organization. Not present when the action is `member_invited`. - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Repository_ruleset_conditions_repository_name_target represents the GeneratedType_Repository_ruleset_conditions_repository_name_target schema from the OpenAPI specification +type GeneratedType_Repository_ruleset_conditions_repository_name_target struct { + Repository_name map[string]interface{} `json:"repository_name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Roster_identifier string `json:"roster_identifier"` // Roster identifier of the student - Student_repository_url string `json:"student_repository_url"` // URL of the student's assignment repository - Group_name string `json:"group_name,omitempty"` // If a group assignment, name of the group the student is in - Points_awarded int `json:"points_awarded"` // Number of points awarded to the student - Starter_code_url string `json:"starter_code_url"` // URL of the starter code for the assignment - Github_username string `json:"github_username"` // GitHub username of the student - Points_available int `json:"points_available"` // Number of points available for the assignment - Student_repository_name string `json:"student_repository_name"` // Name of the student's assignment repository - Submission_timestamp string `json:"submission_timestamp"` // Timestamp of the student's assignment submission - Assignment_name string `json:"assignment_name"` // Name of the assignment - Assignment_url string `json:"assignment_url"` // URL of the assignment +// GeneratedType_Review_custom_gates_state_required represents the GeneratedType_Review_custom_gates_state_required schema from the OpenAPI specification +type GeneratedType_Review_custom_gates_state_required struct { + Environment_name string `json:"environment_name"` // The name of the environment to approve or reject. + State string `json:"state"` // Whether to approve or reject deployment to the specified environments. + Comment string `json:"comment,omitempty"` // Optional comment to include with the review. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Issue_event_rename represents the GeneratedType_Issue_event_rename schema from the OpenAPI specification +type GeneratedType_Issue_event_rename struct { + To string `json:"to"` + From string `json:"from"` } -// Webhookssecurityadvisory represents the Webhookssecurityadvisory schema from the OpenAPI specification -type Webhookssecurityadvisory struct { - Identifiers []map[string]interface{} `json:"identifiers"` - References []map[string]interface{} `json:"references"` - Withdrawn_at string `json:"withdrawn_at"` - Severity string `json:"severity"` - Vulnerabilities []map[string]interface{} `json:"vulnerabilities"` - Cvss map[string]interface{} `json:"cvss"` - Cwes []map[string]interface{} `json:"cwes"` - Ghsa_id string `json:"ghsa_id"` - Summary string `json:"summary"` - Updated_at string `json:"updated_at"` - Cvss_severities GeneratedType `json:"cvss_severities,omitempty"` - Description string `json:"description"` - Published_at string `json:"published_at"` +// Vulnerability represents the Vulnerability schema from the OpenAPI specification +type Vulnerability struct { + PackageField map[string]interface{} `json:"package"` // The name of the package affected by the vulnerability. + Vulnerable_functions []string `json:"vulnerable_functions"` // The functions in the package that are affected by the vulnerability. + Vulnerable_version_range string `json:"vulnerable_version_range"` // The range of the package versions affected by the vulnerability. + First_patched_version string `json:"first_patched_version"` // The package version that resolves the vulnerability. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_installation_target_renamed represents the GeneratedType_Webhook_installation_target_renamed schema from the OpenAPI specification +type GeneratedType_Webhook_installation_target_renamed struct { Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Target_type string `json:"target_type"` + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Account map[string]interface{} `json:"account"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Message string `json:"message,omitempty"` - Metadata map[string]interface{} `json:"metadata,omitempty"` - Status string `json:"status,omitempty"` - Documentation_url string `json:"documentation_url,omitempty"` +// GeneratedType_Webhook_check_run_requested_action represents the GeneratedType_Webhook_check_run_requested_action schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_requested_action struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requested_action map[string]interface{} `json:"requested_action,omitempty"` // The action requested by the user. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Check_run GeneratedType_Check_run_with_simple_check_suite `json:"check_run"` // A check performed on the code of a given code change } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_url string `json:"commit_url"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Created_at string `json:"created_at"` - Event string `json:"event"` - Id int `json:"id"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Commit_id string `json:"commit_id"` - Node_id string `json:"node_id"` - Milestone map[string]interface{} `json:"milestone"` - Url string `json:"url"` +// GeneratedType_Repository_rule_update represents the GeneratedType_Repository_rule_update schema from the OpenAPI specification +type GeneratedType_Repository_rule_update struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pending_cancellation int `json:"pending_cancellation,omitempty"` // The number of seats that are pending cancellation at the end of the current billing cycle. - Pending_invitation int `json:"pending_invitation,omitempty"` // The number of users who have been invited to receive a Copilot seat through this organization. - Total int `json:"total,omitempty"` // The total number of seats being billed for the organization as of the current billing cycle. - Active_this_cycle int `json:"active_this_cycle,omitempty"` // The number of seats that have used Copilot during the current billing cycle. - Added_this_cycle int `json:"added_this_cycle,omitempty"` // Seats added during the current billing cycle. - Inactive_this_cycle int `json:"inactive_this_cycle,omitempty"` // The number of seats that have not used Copilot during the current billing cycle. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_project_card_moved represents the GeneratedType_Webhook_project_card_moved schema from the OpenAPI specification +type GeneratedType_Webhook_project_card_moved struct { + Changes map[string]interface{} `json:"changes,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_card interface{} `json:"project_card"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Effective_date string `json:"effective_date"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Previous_marketplace_purchase Webhookspreviousmarketplacepurchase `json:"previous_marketplace_purchase,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url"` - Id int `json:"id"` - Login string `json:"login"` - Name string `json:"name"` - Node_id string `json:"node_id"` - Avatar_url string `json:"avatar_url"` +// GeneratedType_Repository_rule_required_deployments represents the GeneratedType_Repository_rule_required_deployments schema from the OpenAPI specification +type GeneratedType_Repository_rule_required_deployments struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` // The `event_type` that was specified in the `POST /repos/{owner}/{repo}/dispatches` request body. - Branch string `json:"branch"` - Client_payload map[string]interface{} `json:"client_payload"` // The `client_payload` that was specified in the `POST /repos/{owner}/{repo}/dispatches` request body. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Repository_rule_file_path_restriction represents the GeneratedType_Repository_rule_file_path_restriction schema from the OpenAPI specification +type GeneratedType_Repository_rule_file_path_restriction struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Evaluation_result string `json:"evaluation_result,omitempty"` // The result of the rule evaluations for rules with the `active` and `evaluate` enforcement statuses, demonstrating whether rules would pass or fail if all rules in the rule suite were `active`. Null if no rules with `evaluate` enforcement status were run. - Repository_name string `json:"repository_name,omitempty"` // The name of the repository without the `.git` extension. - After_sha string `json:"after_sha,omitempty"` // The last commit sha in the push evaluation. - Pushed_at string `json:"pushed_at,omitempty"` - Ref string `json:"ref,omitempty"` // The ref name that the evaluation ran on. - Repository_id int `json:"repository_id,omitempty"` // The ID of the repository associated with the rule evaluation. - Before_sha string `json:"before_sha,omitempty"` // The first commit sha before the push evaluation. - Actor_id int `json:"actor_id,omitempty"` // The number that identifies the user. - Id int `json:"id,omitempty"` // The unique identifier of the rule insight. - Result string `json:"result,omitempty"` // The result of the rule evaluations for rules with the `active` enforcement status. - Rule_evaluations []map[string]interface{} `json:"rule_evaluations,omitempty"` // Details on the evaluated rules. - Actor_name string `json:"actor_name,omitempty"` // The handle for the GitHub user account. +// GeneratedType_Code_scanning_default_setup represents the GeneratedType_Code_scanning_default_setup schema from the OpenAPI specification +type GeneratedType_Code_scanning_default_setup struct { + Schedule string `json:"schedule,omitempty"` // The frequency of the periodic analysis. + State string `json:"state,omitempty"` // Code scanning default setup has been configured or not. + Threat_model string `json:"threat_model,omitempty"` // Threat model to be used for code scanning analysis. Use `remote` to analyze only network sources and `remote_and_local` to include local sources like filesystem access, command-line arguments, database reads, environment variable and standard input. + Updated_at string `json:"updated_at,omitempty"` // Timestamp of latest configuration update. + Languages []string `json:"languages,omitempty"` // Languages to be analyzed. + Query_suite string `json:"query_suite,omitempty"` // CodeQL query suite to be used. + Runner_label string `json:"runner_label,omitempty"` // Runner label to be used if the runner type is labeled. + Runner_type string `json:"runner_type,omitempty"` // Runner type to be used. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_deployment_review_rejected represents the GeneratedType_Webhook_deployment_review_rejected schema from the OpenAPI specification +type GeneratedType_Webhook_deployment_review_rejected struct { + Workflow_job_runs []map[string]interface{} `json:"workflow_job_runs,omitempty"` + Comment string `json:"comment,omitempty"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow_run map[string]interface{} `json:"workflow_run"` Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Workflow_job_run Webhooksworkflowjobrun `json:"workflow_job_run,omitempty"` + Approver Webhooksapprover `json:"approver,omitempty"` + Reviewers []map[string]interface{} `json:"reviewers,omitempty"` + Since string `json:"since"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation Installation `json:"installation"` // Installation - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requester interface{} `json:"requester,omitempty"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Project_column represents the GeneratedType_Project_column schema from the OpenAPI specification +type GeneratedType_Project_column struct { + Project_url string `json:"project_url"` + Updated_at string `json:"updated_at"` + Url string `json:"url"` + Cards_url string `json:"cards_url"` + Created_at string `json:"created_at"` + Id int `json:"id"` // The unique identifier of the project column + Name string `json:"name"` // Name of the project column + Node_id string `json:"node_id"` } -// Enterprise represents the Enterprise schema from the OpenAPI specification -type Enterprise struct { - Description string `json:"description,omitempty"` // A short description of the enterprise. - Node_id string `json:"node_id"` - Html_url string `json:"html_url"` - Id int `json:"id"` // Unique identifier of the enterprise - Slug string `json:"slug"` // The slug url identifier for the enterprise. - Website_url string `json:"website_url,omitempty"` // The enterprise's website URL. - Avatar_url string `json:"avatar_url"` - Name string `json:"name"` // The name of the enterprise. +// GeneratedType_Deployment_status represents the GeneratedType_Deployment_status schema from the OpenAPI specification +type GeneratedType_Deployment_status struct { + Url string `json:"url"` + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. + Repository_url string `json:"repository_url"` + Id int64 `json:"id"` Updated_at string `json:"updated_at"` + Deployment_url string `json:"deployment_url"` + Node_id string `json:"node_id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Target_url string `json:"target_url"` // Closing down notice: the URL to associate with this status. Created_at string `json:"created_at"` + Description string `json:"description"` // A short description of the status. + Environment string `json:"environment,omitempty"` // The environment of the deployment that the status is for. + Log_url string `json:"log_url,omitempty"` // The URL to associate with this status. + State string `json:"state"` // The state of the status. + Environment_url string `json:"environment_url,omitempty"` // The URL for accessing your environment. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Security_advisory Webhookssecurityadvisory `json:"security_advisory"` // The details of the security advisory, including summary, description, and severity. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_repository_advisory_reported represents the GeneratedType_Webhook_repository_advisory_reported schema from the OpenAPI specification +type GeneratedType_Webhook_repository_advisory_reported struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Repository_advisory GeneratedType_Repository_advisory `json:"repository_advisory"` // A repository security advisory. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." -} - -// Hovercard represents the Hovercard schema from the OpenAPI specification -type Hovercard struct { - Contexts []map[string]interface{} `json:"contexts"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Code int `json:"code"` - Message string `json:"message"` - Status string `json:"status"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Invitation_source string `json:"invitation_source,omitempty"` - Login string `json:"login"` - Created_at string `json:"created_at"` - Failed_reason string `json:"failed_reason,omitempty"` - Invitation_teams_url string `json:"invitation_teams_url"` - Failed_at string `json:"failed_at,omitempty"` - Inviter GeneratedType `json:"inviter"` // A GitHub user. +// GeneratedType_User_role_assignment represents the GeneratedType_User_role_assignment schema from the OpenAPI specification +type GeneratedType_User_role_assignment struct { + TypeField string `json:"type"` + Avatar_url string `json:"avatar_url"` + Inherited_from []GeneratedType_Team_simple `json:"inherited_from,omitempty"` // Team the user has gotten the role through + Name string `json:"name,omitempty"` + Starred_at string `json:"starred_at,omitempty"` + Repos_url string `json:"repos_url"` Node_id string `json:"node_id"` - Id int64 `json:"id"` - Role string `json:"role"` - Team_count int `json:"team_count"` - Email string `json:"email"` + Gravatar_id string `json:"gravatar_id"` + Login string `json:"login"` + Following_url string `json:"following_url"` + Site_admin bool `json:"site_admin"` + Subscriptions_url string `json:"subscriptions_url"` + Assignment string `json:"assignment,omitempty"` // Determines if the user has a direct, indirect, or mixed relationship to a role + Html_url string `json:"html_url"` + Followers_url string `json:"followers_url"` + Id int `json:"id"` + Gists_url string `json:"gists_url"` + Organizations_url string `json:"organizations_url"` + Received_events_url string `json:"received_events_url"` + Starred_url string `json:"starred_url"` + Url string `json:"url"` + User_view_type string `json:"user_view_type,omitempty"` + Events_url string `json:"events_url"` + Email string `json:"email,omitempty"` } -// Runner represents the Runner schema from the OpenAPI specification -type Runner struct { - Runner_group_id int `json:"runner_group_id,omitempty"` // The ID of the runner group. - Status string `json:"status"` // The status of the runner. - Busy bool `json:"busy"` - Ephemeral bool `json:"ephemeral,omitempty"` - Id int `json:"id"` // The ID of the runner. - Labels []GeneratedType `json:"labels"` - Name string `json:"name"` // The name of the runner. - Os string `json:"os"` // The Operating System of the runner. +// GeneratedType_Issue_event_milestone represents the GeneratedType_Issue_event_milestone schema from the OpenAPI specification +type GeneratedType_Issue_event_milestone struct { + Title string `json:"title"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Webhook_pull_request_review_thread_unresolved represents the GeneratedType_Webhook_pull_request_review_thread_unresolved schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_thread_unresolved struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Thread map[string]interface{} `json:"thread"` + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Description string `json:"description,omitempty"` - Fork_of map[string]interface{} `json:"fork_of,omitempty"` // Gist - Git_pull_url string `json:"git_pull_url,omitempty"` - Forks []map[string]interface{} `json:"forks,omitempty"` - Owner GeneratedType `json:"owner,omitempty"` // A GitHub user. - Node_id string `json:"node_id,omitempty"` - Html_url string `json:"html_url,omitempty"` - Commits_url string `json:"commits_url,omitempty"` - Id string `json:"id,omitempty"` - Url string `json:"url,omitempty"` - Created_at string `json:"created_at,omitempty"` - Forks_url string `json:"forks_url,omitempty"` - Updated_at string `json:"updated_at,omitempty"` - History []GeneratedType `json:"history,omitempty"` - Truncated bool `json:"truncated,omitempty"` - Files map[string]interface{} `json:"files,omitempty"` - User string `json:"user,omitempty"` - Comments_enabled bool `json:"comments_enabled,omitempty"` - Comments_url string `json:"comments_url,omitempty"` - Git_push_url string `json:"git_push_url,omitempty"` - Comments int `json:"comments,omitempty"` - Public bool `json:"public,omitempty"` +// GeneratedType_Webhook_code_scanning_alert_created represents the GeneratedType_Webhook_code_scanning_alert_created schema from the OpenAPI specification +type GeneratedType_Webhook_code_scanning_alert_created struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_pull_request_review_thread_resolved represents the GeneratedType_Webhook_pull_request_review_thread_resolved schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_thread_resolved struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Thread map[string]interface{} `json:"thread"` Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` } -// Thread represents the Thread schema from the OpenAPI specification -type Thread struct { - Unread bool `json:"unread"` - Updated_at string `json:"updated_at"` - Id string `json:"id"` - Repository GeneratedType `json:"repository"` // Minimal Repository - Subject map[string]interface{} `json:"subject"` - Last_read_at string `json:"last_read_at"` +// Verification represents the Verification schema from the OpenAPI specification +type Verification struct { + Payload string `json:"payload"` Reason string `json:"reason"` - Url string `json:"url"` - Subscription_url string `json:"subscription_url"` + Signature string `json:"signature"` + Verified bool `json:"verified"` + Verified_at string `json:"verified_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Analyses_url string `json:"analyses_url,omitempty"` // The REST API URL for getting the analyses associated with the upload. - Errors []string `json:"errors,omitempty"` // Any errors that ocurred during processing of the delivery. - Processing_status string `json:"processing_status,omitempty"` // `pending` files have not yet been processed, while `complete` means results from the SARIF have been stored. `failed` files have either not been processed at all, or could only be partially processed. +// GeneratedType_Secret_scanning_alert represents the GeneratedType_Secret_scanning_alert schema from the OpenAPI specification +type GeneratedType_Secret_scanning_alert struct { + First_location_detected interface{} `json:"first_location_detected,omitempty"` // Details on the location where the token was initially detected. This can be a commit, wiki commit, issue, discussion, pull request. + Url string `json:"url,omitempty"` // The REST API URL of the alert resource. + Secret_type_display_name string `json:"secret_type_display_name,omitempty"` // User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)." + Html_url string `json:"html_url,omitempty"` // The GitHub URL of the alert resource. + Multi_repo bool `json:"multi_repo,omitempty"` // Whether the detected secret was found in multiple repositories under the same organization or enterprise. + Publicly_leaked bool `json:"publicly_leaked,omitempty"` // Whether the detected secret was publicly leaked. + Secret string `json:"secret,omitempty"` // The secret that was detected. + Resolution_comment string `json:"resolution_comment,omitempty"` // An optional comment to resolve an alert. + Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Has_more_locations bool `json:"has_more_locations,omitempty"` // A boolean value representing whether or not the token in the alert was detected in more than one location. + Push_protection_bypassed bool `json:"push_protection_bypassed,omitempty"` // Whether push protection was bypassed for the detected secret. + Push_protection_bypass_request_comment string `json:"push_protection_bypass_request_comment,omitempty"` // An optional comment when requesting a push protection bypass. + Push_protection_bypassed_by GeneratedType_Nullable_simple_user `json:"push_protection_bypassed_by,omitempty"` // A GitHub user. + Resolved_by GeneratedType_Nullable_simple_user `json:"resolved_by,omitempty"` // A GitHub user. + Secret_type string `json:"secret_type,omitempty"` // The type of secret that secret scanning detected. + State string `json:"state,omitempty"` // Sets the state of the secret scanning alert. You must provide `resolution` when you set the state to `resolved`. + Validity string `json:"validity,omitempty"` // The token status as of the latest validity check. + Number int `json:"number,omitempty"` // The security alert number. + Resolved_at string `json:"resolved_at,omitempty"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Locations_url string `json:"locations_url,omitempty"` // The REST API URL of the code locations for this alert. + Push_protection_bypass_request_html_url string `json:"push_protection_bypass_request_html_url,omitempty"` // The URL to a push protection bypass request. + Push_protection_bypass_request_reviewer_comment string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` // An optional comment when reviewing a push protection bypass. + Is_base64_encoded bool `json:"is_base64_encoded,omitempty"` // A boolean value representing whether or not alert is base64 encoded + Push_protection_bypass_request_reviewer GeneratedType_Nullable_simple_user `json:"push_protection_bypass_request_reviewer,omitempty"` // A GitHub user. + Push_protection_bypassed_at string `json:"push_protection_bypassed_at,omitempty"` // The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Resolution string `json:"resolution,omitempty"` // **Required when the `state` is `resolved`.** The reason for resolving the alert. + Created_at string `json:"created_at,omitempty"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_issues_closed represents the GeneratedType_Webhook_issues_closed schema from the OpenAPI specification +type GeneratedType_Webhook_issues_closed struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` // The action that was performed. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Spdx_id string `json:"spdx_id"` +// GeneratedType_Nullable_community_health_file represents the GeneratedType_Nullable_community_health_file schema from the OpenAPI specification +type GeneratedType_Nullable_community_health_file struct { Url string `json:"url"` - Html_url string `json:"html_url,omitempty"` - Key string `json:"key"` - Name string `json:"name"` - Node_id string `json:"node_id"` + Html_url string `json:"html_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Check_suite map[string]interface{} `json:"check_suite"` // The [check_suite](https://docs.github.com/rest/checks/suites#get-a-check-suite). - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Check_run_with_simple_check_suite represents the GeneratedType_Check_run_with_simple_check_suite schema from the OpenAPI specification +type GeneratedType_Check_run_with_simple_check_suite struct { + Check_suite GeneratedType_Simple_check_suite `json:"check_suite"` // A suite of checks performed on the code of a given code change + Head_sha string `json:"head_sha"` // The SHA of the commit that is being checked. + Node_id string `json:"node_id"` + Pull_requests []GeneratedType_Pull_request_minimal `json:"pull_requests"` + Started_at string `json:"started_at"` + Id int `json:"id"` // The id of the check. + Status string `json:"status"` // The phase of the lifecycle that the check is currently in. + Url string `json:"url"` + Name string `json:"name"` // The name of the check. + Conclusion string `json:"conclusion"` + Completed_at string `json:"completed_at"` + External_id string `json:"external_id"` + Deployment GeneratedType_Deployment_simple `json:"deployment,omitempty"` // A deployment created as the result of an Actions check run from a workflow that references an environment + Details_url string `json:"details_url"` + Output map[string]interface{} `json:"output"` + Html_url string `json:"html_url"` + App Integration `json:"app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Definition GeneratedType `json:"definition"` // Custom property defined on an organization - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Combined_billing_usage represents the GeneratedType_Combined_billing_usage schema from the OpenAPI specification +type GeneratedType_Combined_billing_usage struct { + Days_left_in_billing_cycle int `json:"days_left_in_billing_cycle"` // Numbers of days left in billing cycle. + Estimated_paid_storage_for_month int `json:"estimated_paid_storage_for_month"` // Estimated storage space (GB) used in billing cycle. + Estimated_storage_for_month int `json:"estimated_storage_for_month"` // Estimated sum of free and paid storage space (GB) used in billing cycle. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Started_at string `json:"started_at,omitempty"` // The time that the scan was started. Empty if the scan is pending - Status string `json:"status,omitempty"` // The state of the scan. Either "completed", "running", or "pending" - TypeField string `json:"type,omitempty"` // The type of scan - Completed_at string `json:"completed_at,omitempty"` // The time that the scan was completed. Empty if the scan is running +// GeneratedType_Public_ip represents the GeneratedType_Public_ip schema from the OpenAPI specification +type GeneratedType_Public_ip struct { + Enabled bool `json:"enabled,omitempty"` // Whether public IP is enabled. + Length int `json:"length,omitempty"` // The length of the IP prefix. + Prefix string `json:"prefix,omitempty"` // The prefix for the public IP. } -// Webhooksworkflow represents the Webhooksworkflow schema from the OpenAPI specification -type Webhooksworkflow struct { - Updated_at string `json:"updated_at"` - Badge_url string `json:"badge_url"` - Created_at string `json:"created_at"` - Id int `json:"id"` - Html_url string `json:"html_url"` - State string `json:"state"` - Name string `json:"name"` - Node_id string `json:"node_id"` - Path string `json:"path"` - Url string `json:"url"` +// GeneratedType_Dependabot_alert_with_repository represents the GeneratedType_Dependabot_alert_with_repository schema from the OpenAPI specification +type GeneratedType_Dependabot_alert_with_repository struct { + Repository GeneratedType_Simple_repository `json:"repository"` // A GitHub repository. + State string `json:"state"` // The state of the Dependabot alert. + Url string `json:"url"` // The REST API URL of the alert resource. + Fixed_at string `json:"fixed_at"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Auto_dismissed_at string `json:"auto_dismissed_at,omitempty"` // The time that the alert was auto-dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Number int `json:"number"` // The security alert number. + Dismissed_comment string `json:"dismissed_comment"` // An optional comment associated with the alert's dismissal. + Security_advisory GeneratedType_Dependabot_alert_security_advisory `json:"security_advisory"` // Details for the GitHub Security Advisory. + Html_url string `json:"html_url"` // The GitHub URL of the alert resource. + Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_by GeneratedType_Nullable_simple_user `json:"dismissed_by"` // A GitHub user. + Security_vulnerability GeneratedType_Dependabot_alert_security_vulnerability `json:"security_vulnerability"` // Details pertaining to one vulnerable version range for the advisory. + Updated_at string `json:"updated_at"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dependency map[string]interface{} `json:"dependency"` // Details for the vulnerable dependency. + Dismissed_reason string `json:"dismissed_reason"` // The reason that the alert was dismissed. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Language string `json:"language"` - Collaborators_url string `json:"collaborators_url"` - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. - Teams_url string `json:"teams_url"` - Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. - Default_branch string `json:"default_branch"` // The default branch of the repository. - Html_url string `json:"html_url"` - Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. - Git_tags_url string `json:"git_tags_url"` - Events_url string `json:"events_url"` - Contents_url string `json:"contents_url"` - Subscribers_url string `json:"subscribers_url"` - Network_count int `json:"network_count,omitempty"` - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. - Master_branch string `json:"master_branch,omitempty"` - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. - Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. - Full_name string `json:"full_name"` - License GeneratedType `json:"license"` // License Simple - Topics []string `json:"topics,omitempty"` - Updated_at string `json:"updated_at"` - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. - Fork bool `json:"fork"` - Merges_url string `json:"merges_url"` - Trees_url string `json:"trees_url"` - Releases_url string `json:"releases_url"` - Name string `json:"name"` // The name of the repository. - Commits_url string `json:"commits_url"` - Id int `json:"id"` // Unique identifier of the repository - Stargazers_count int `json:"stargazers_count"` - Downloads_url string `json:"downloads_url"` - Issue_comment_url string `json:"issue_comment_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. - Has_projects bool `json:"has_projects"` // Whether projects are enabled. - Pushed_at string `json:"pushed_at"` - Hooks_url string `json:"hooks_url"` - Tags_url string `json:"tags_url"` - Git_commits_url string `json:"git_commits_url"` - Mirror_url string `json:"mirror_url"` - Watchers_count int `json:"watchers_count"` - Forks_url string `json:"forks_url"` - Contributors_url string `json:"contributors_url"` - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged - Owner GeneratedType `json:"owner"` // A GitHub user. +// GeneratedType_Unassigned_issue_event represents the GeneratedType_Unassigned_issue_event schema from the OpenAPI specification +type GeneratedType_Unassigned_issue_event struct { Node_id string `json:"node_id"` - Subscription_url string `json:"subscription_url"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Archive_url string `json:"archive_url"` - Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo - Languages_url string `json:"languages_url"` - Pulls_url string `json:"pulls_url"` - Milestones_url string `json:"milestones_url"` - Keys_url string `json:"keys_url"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Event string `json:"event"` + Id int `json:"id"` + Assigner GeneratedType_Simple_user `json:"assigner"` // A GitHub user. Url string `json:"url"` + Commit_url string `json:"commit_url"` Created_at string `json:"created_at"` - Role_name string `json:"role_name,omitempty"` - Deployments_url string `json:"deployments_url"` - Private bool `json:"private"` // Whether the repository is private or public. - Size int `json:"size"` - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. - Assignees_url string `json:"assignees_url"` - Open_issues int `json:"open_issues"` - Git_url string `json:"git_url"` - Stargazers_url string `json:"stargazers_url"` - Watchers int `json:"watchers"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + Assignee GeneratedType_Simple_user `json:"assignee"` // A GitHub user. + Commit_id string `json:"commit_id"` +} + +// GeneratedType_Authentication_token represents the GeneratedType_Authentication_token schema from the OpenAPI specification +type GeneratedType_Authentication_token struct { + Token string `json:"token"` // The token used for authentication + Expires_at string `json:"expires_at"` // The time this token expires Permissions map[string]interface{} `json:"permissions,omitempty"` - Has_issues bool `json:"has_issues"` // Whether issues are enabled. - Branches_url string `json:"branches_url"` - Issue_events_url string `json:"issue_events_url"` - Statuses_url string `json:"statuses_url"` - Git_refs_url string `json:"git_refs_url"` - Description string `json:"description"` - Homepage string `json:"homepage"` - Ssh_url string `json:"ssh_url"` - Compare_url string `json:"compare_url"` - Forks int `json:"forks"` - Forks_count int `json:"forks_count"` - Comments_url string `json:"comments_url"` - Archived bool `json:"archived"` // Whether the repository is archived. - Has_pages bool `json:"has_pages"` - Issues_url string `json:"issues_url"` - Notifications_url string `json:"notifications_url"` - Subscribers_count int `json:"subscribers_count,omitempty"` - Labels_url string `json:"labels_url"` - Blobs_url string `json:"blobs_url"` - Open_issues_count int `json:"open_issues_count"` - Clone_url string `json:"clone_url"` - Svn_url string `json:"svn_url"` + Repositories []Repository `json:"repositories,omitempty"` // The repositories this token has access to + Repository_selection string `json:"repository_selection,omitempty"` // Describe whether all repositories have been selected or there's a selection involved + Single_file string `json:"single_file,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Commit_id string `json:"commit_id"` - Commit_url string `json:"commit_url"` - Node_id string `json:"node_id"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Created_at string `json:"created_at"` - Id int `json:"id"` +// GeneratedType_Webhook_pull_request_milestoned represents the GeneratedType_Webhook_pull_request_milestoned schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_milestoned struct { + Milestone Milestone `json:"milestone,omitempty"` // A collection of related issues and pull requests. + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request Webhookspullrequest5 `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +} + +// GeneratedType_Content_tree represents the GeneratedType_Content_tree schema from the OpenAPI specification +type GeneratedType_Content_tree struct { + Encoding string `json:"encoding,omitempty"` + Git_url string `json:"git_url"` + Name string `json:"name"` + Sha string `json:"sha"` + Links map[string]interface{} `json:"_links"` + Size int `json:"size"` + TypeField string `json:"type"` + Content string `json:"content,omitempty"` + Entries []map[string]interface{} `json:"entries,omitempty"` + Html_url string `json:"html_url"` + Path string `json:"path"` + Download_url string `json:"download_url"` Url string `json:"url"` - Assigner GeneratedType `json:"assigner"` // A GitHub user. - Event string `json:"event"` - Assignee GeneratedType `json:"assignee"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_pull_request_ready_for_review represents the GeneratedType_Webhook_pull_request_ready_for_review schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_ready_for_review struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request GeneratedType_Pull_request_webhook `json:"pull_request"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` - Repository_url string `json:"repository_url"` - Target_url string `json:"target_url"` // Closing down notice: the URL to associate with this status. - Description string `json:"description"` // A short description of the status. - Environment string `json:"environment,omitempty"` // The environment of the deployment that the status is for. - Deployment_url string `json:"deployment_url"` - Id int64 `json:"id"` - Updated_at string `json:"updated_at"` - Creator GeneratedType `json:"creator"` // A GitHub user. - Environment_url string `json:"environment_url,omitempty"` // The URL for accessing your environment. - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Log_url string `json:"log_url,omitempty"` // The URL to associate with this status. - Url string `json:"url"` - Node_id string `json:"node_id"` - State string `json:"state"` // The state of the status. +// GeneratedType_Webhook_sponsorship_pending_cancellation represents the GeneratedType_Webhook_sponsorship_pending_cancellation schema from the OpenAPI specification +type GeneratedType_Webhook_sponsorship_pending_cancellation struct { + Effective_date string `json:"effective_date,omitempty"` // The `pending_cancellation` and `pending_tier_change` event types will include the date the cancellation or tier change will take effect. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Sponsorship Webhookssponsorship `json:"sponsorship"` + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request_body_url string `json:"pull_request_body_url"` // The API URL to get the pull request where the secret was detected. +// GeneratedType_Repository_ruleset_conditions_repository_property_spec represents the GeneratedType_Repository_ruleset_conditions_repository_property_spec schema from the OpenAPI specification +type GeneratedType_Repository_ruleset_conditions_repository_property_spec struct { + Name string `json:"name"` // The name of the repository property to target + Property_values []string `json:"property_values"` // The values to match for the repository property + Source string `json:"source,omitempty"` // The source of the repository property. Defaults to 'custom' if not specified. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Key Webhooksdeploykey `json:"key"` // The [`deploy key`](https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key) resource. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// Email represents the Email schema from the OpenAPI specification +type Email struct { + Email string `json:"email"` + Primary bool `json:"primary"` + Verified bool `json:"verified"` + Visibility string `json:"visibility"` +} + +// GeneratedType_Webhook_pull_request_reopened represents the GeneratedType_Webhook_pull_request_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_reopened struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request GeneratedType_Pull_request_webhook `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Secret_scanning_delegated_bypass string `json:"secret_scanning_delegated_bypass,omitempty"` // The enablement status of secret scanning delegated bypass - Dependabot_security_updates string `json:"dependabot_security_updates,omitempty"` // The enablement status of Dependabot security updates - Dependency_graph_autosubmit_action_options map[string]interface{} `json:"dependency_graph_autosubmit_action_options,omitempty"` // Feature options for Automatic dependency submission - Secret_scanning_generic_secrets string `json:"secret_scanning_generic_secrets,omitempty"` // The enablement status of Copilot secret scanning - Code_scanning_default_setup string `json:"code_scanning_default_setup,omitempty"` // The enablement status of code scanning default setup - Code_scanning_options map[string]interface{} `json:"code_scanning_options,omitempty"` // Feature options for code scanning - Dependabot_alerts string `json:"dependabot_alerts,omitempty"` // The enablement status of Dependabot alerts - Enforcement string `json:"enforcement,omitempty"` // The enforcement status for a security configuration - Html_url string `json:"html_url,omitempty"` // The URL of the configuration - Url string `json:"url,omitempty"` // The URL of the configuration - Secret_scanning_non_provider_patterns string `json:"secret_scanning_non_provider_patterns,omitempty"` // The enablement status of secret scanning non-provider patterns - Dependency_graph_autosubmit_action string `json:"dependency_graph_autosubmit_action,omitempty"` // The enablement status of Automatic dependency submission - Id int `json:"id,omitempty"` // The ID of the code security configuration - Private_vulnerability_reporting string `json:"private_vulnerability_reporting,omitempty"` // The enablement status of private vulnerability reporting - Secret_scanning_delegated_bypass_options map[string]interface{} `json:"secret_scanning_delegated_bypass_options,omitempty"` // Feature options for secret scanning delegated bypass - Dependency_graph string `json:"dependency_graph,omitempty"` // The enablement status of Dependency Graph - Secret_scanning_push_protection string `json:"secret_scanning_push_protection,omitempty"` // The enablement status of secret scanning push protection - Updated_at string `json:"updated_at,omitempty"` - Code_scanning_delegated_alert_dismissal string `json:"code_scanning_delegated_alert_dismissal,omitempty"` // The enablement status of code scanning delegated alert dismissal - Secret_scanning_delegated_alert_dismissal string `json:"secret_scanning_delegated_alert_dismissal,omitempty"` // The enablement status of secret scanning delegated alert dismissal - Secret_scanning_validity_checks string `json:"secret_scanning_validity_checks,omitempty"` // The enablement status of secret scanning validity checks - Advanced_security string `json:"advanced_security,omitempty"` // The enablement status of GitHub Advanced Security - Code_scanning_default_setup_options map[string]interface{} `json:"code_scanning_default_setup_options,omitempty"` // Feature options for code scanning default setup - Created_at string `json:"created_at,omitempty"` - Target_type string `json:"target_type,omitempty"` // The type of the code security configuration. - Secret_scanning string `json:"secret_scanning,omitempty"` // The enablement status of secret scanning - Description string `json:"description,omitempty"` // A description of the code security configuration - Name string `json:"name,omitempty"` // The name of the code security configuration. Must be unique within the organization. +// GeneratedType_Protected_branch_admin_enforced represents the GeneratedType_Protected_branch_admin_enforced schema from the OpenAPI specification +type GeneratedType_Protected_branch_admin_enforced struct { + Enabled bool `json:"enabled"` + Url string `json:"url"` } -// Webhooksteam represents the Webhooksteam schema from the OpenAPI specification -type Webhooksteam struct { - Node_id string `json:"node_id,omitempty"` - Notification_setting string `json:"notification_setting,omitempty"` - Privacy string `json:"privacy,omitempty"` - Members_url string `json:"members_url,omitempty"` - Name string `json:"name"` // Name of the team - Repositories_url string `json:"repositories_url,omitempty"` - Deleted bool `json:"deleted,omitempty"` - Description string `json:"description,omitempty"` // Description of the team - Permission string `json:"permission,omitempty"` // Permission that the team will have for its repositories - Slug string `json:"slug,omitempty"` - Url string `json:"url,omitempty"` // URL for the team - Html_url string `json:"html_url,omitempty"` - Id int `json:"id"` // Unique identifier of the team - Parent map[string]interface{} `json:"parent,omitempty"` +// GeneratedType_Porter_large_file represents the GeneratedType_Porter_large_file schema from the OpenAPI specification +type GeneratedType_Porter_large_file struct { + Path string `json:"path"` + Ref_name string `json:"ref_name"` + Size int `json:"size"` + Oid string `json:"oid"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id"` - Id int `json:"id"` // Unique identifier of the team - Name string `json:"name"` // Name of the team - Permission string `json:"permission"` // Permission that the team will have for its repositories - Privacy string `json:"privacy,omitempty"` // The level of privacy this team should have - Repositories_url string `json:"repositories_url"` - Description string `json:"description"` // Description of the team - Html_url string `json:"html_url"` - Notification_setting string `json:"notification_setting,omitempty"` // The notification setting the team has set - Slug string `json:"slug"` - Url string `json:"url"` // URL for the team - Ldap_dn string `json:"ldap_dn,omitempty"` // Distinguished Name (DN) that team maps to within LDAP environment - Members_url string `json:"members_url"` +// GeneratedType_Code_scanning_alert_rule represents the GeneratedType_Code_scanning_alert_rule schema from the OpenAPI specification +type GeneratedType_Code_scanning_alert_rule struct { + Security_severity_level string `json:"security_severity_level,omitempty"` // The security severity of the alert. + Tags []string `json:"tags,omitempty"` // A set of tags applicable for the rule. + Help string `json:"help,omitempty"` // Detailed documentation for the rule as GitHub Flavored Markdown. + Severity string `json:"severity,omitempty"` // The severity of the alert. + Full_description string `json:"full_description,omitempty"` // A description of the rule used to detect the alert. + Name string `json:"name,omitempty"` // The name of the rule used to detect the alert. + Description string `json:"description,omitempty"` // A short description of the rule used to detect the alert. + Help_uri string `json:"help_uri,omitempty"` // A link to the documentation for the rule used to detect the alert. + Id string `json:"id,omitempty"` // A unique identifier for the rule used to detect the alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - PackageField map[string]interface{} `json:"package"` // Information about the package. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Secret_scanning_location_pull_request_comment represents the GeneratedType_Secret_scanning_location_pull_request_comment schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_pull_request_comment struct { + Pull_request_comment_url string `json:"pull_request_comment_url"` // The API URL to get the pull request comment where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` - Id int `json:"id"` - Key string `json:"key"` - Title string `json:"title"` +// GeneratedType_Webhook_discussion_deleted represents the GeneratedType_Webhook_discussion_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_deleted struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// Webhookssponsorship represents the Webhookssponsorship schema from the OpenAPI specification -type Webhookssponsorship struct { - Privacy_level string `json:"privacy_level"` - Sponsor map[string]interface{} `json:"sponsor"` - Sponsorable map[string]interface{} `json:"sponsorable"` - Tier map[string]interface{} `json:"tier"` // The `tier_changed` and `pending_tier_change` will include the original tier before the change or pending change. For more information, see the pending tier change payload. - Created_at string `json:"created_at"` - Maintainer map[string]interface{} `json:"maintainer,omitempty"` - Node_id string `json:"node_id"` +// GeneratedType_Webhook_issues_typed represents the GeneratedType_Webhook_issues_typed schema from the OpenAPI specification +type GeneratedType_Webhook_issues_typed struct { + Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + TypeField GeneratedType_Issue_type `json:"type"` // The type of issue. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Github_enterprise_importer []string `json:"github_enterprise_importer,omitempty"` - Ssh_key_fingerprints map[string]interface{} `json:"ssh_key_fingerprints,omitempty"` - Actions []string `json:"actions,omitempty"` - Verifiable_password_authentication bool `json:"verifiable_password_authentication"` - Codespaces []string `json:"codespaces,omitempty"` - Dependabot []string `json:"dependabot,omitempty"` - Domains map[string]interface{} `json:"domains,omitempty"` - Packages []string `json:"packages,omitempty"` - Web []string `json:"web,omitempty"` - Copilot []string `json:"copilot,omitempty"` - Actions_macos []string `json:"actions_macos,omitempty"` - Hooks []string `json:"hooks,omitempty"` - Pages []string `json:"pages,omitempty"` - Git []string `json:"git,omitempty"` - Ssh_keys []string `json:"ssh_keys,omitempty"` - Api []string `json:"api,omitempty"` - Importer []string `json:"importer,omitempty"` +// GeneratedType_Webhook_merge_group_destroyed represents the GeneratedType_Webhook_merge_group_destroyed schema from the OpenAPI specification +type GeneratedType_Webhook_merge_group_destroyed struct { + Action string `json:"action"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Merge_group GeneratedType_Merge_group `json:"merge_group"` // A group of pull requests that the merge queue has grouped together to be merged. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Reason string `json:"reason,omitempty"` // Explains why the merge group is being destroyed. The group could have been merged, removed from the queue (dequeued), or invalidated by an earlier queue entry being dequeued (invalidated). + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Provider string `json:"provider"` +// GeneratedType_Check_suite represents the GeneratedType_Check_suite schema from the OpenAPI specification +type GeneratedType_Check_suite struct { + Check_runs_url string `json:"check_runs_url"` + Conclusion string `json:"conclusion"` + Runs_rerequestable bool `json:"runs_rerequestable,omitempty"` + Before string `json:"before"` + Head_sha string `json:"head_sha"` // The SHA of the head commit that is being checked. + Node_id string `json:"node_id"` + Pull_requests []GeneratedType_Pull_request_minimal `json:"pull_requests"` + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + App GeneratedType_Nullable_integration `json:"app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Id int64 `json:"id"` + Head_commit GeneratedType_Simple_commit `json:"head_commit"` // A commit. + Head_branch string `json:"head_branch"` + Latest_check_runs_count int `json:"latest_check_runs_count"` + Status string `json:"status"` // The phase of the lifecycle that the check suite is currently in. Statuses of waiting, requested, and pending are reserved for GitHub Actions check suites. + After string `json:"after"` + Created_at string `json:"created_at"` + Rerequestable bool `json:"rerequestable,omitempty"` Url string `json:"url"` + Updated_at string `json:"updated_at"` } -// Webhooksmarketplacepurchase represents the Webhooksmarketplacepurchase schema from the OpenAPI specification -type Webhooksmarketplacepurchase struct { - On_free_trial bool `json:"on_free_trial"` - Plan map[string]interface{} `json:"plan"` - Unit_count int `json:"unit_count"` - Account map[string]interface{} `json:"account"` - Billing_cycle string `json:"billing_cycle"` - Free_trial_ends_on string `json:"free_trial_ends_on"` - Next_billing_date string `json:"next_billing_date"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Key string `json:"key"` // The Base64 encoded public key. - Key_id string `json:"key_id"` // The identifier for the key. +// GeneratedType_Webhook_discussion_locked represents the GeneratedType_Webhook_discussion_locked schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_locked struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the variable. - Updated_at string `json:"updated_at"` // The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Value string `json:"value"` // The value of the variable. - Created_at string `json:"created_at"` // The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. +// GeneratedType_Webhook_deployment_review_requested represents the GeneratedType_Webhook_deployment_review_requested schema from the OpenAPI specification +type GeneratedType_Webhook_deployment_review_requested struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Since string `json:"since"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Reviewers []map[string]interface{} `json:"reviewers"` + Workflow_job_run map[string]interface{} `json:"workflow_job_run"` + Workflow_run map[string]interface{} `json:"workflow_run"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Requestor Webhooksuser `json:"requestor"` + Action string `json:"action"` + Environment string `json:"environment"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Expiry string `json:"expiry,omitempty"` // The duration of the interaction restriction. Default: `one_day`. - Limit string `json:"limit"` // The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. +// GeneratedType_Nullable_codespace_machine represents the GeneratedType_Nullable_codespace_machine schema from the OpenAPI specification +type GeneratedType_Nullable_codespace_machine struct { + Operating_system string `json:"operating_system"` // The operating system of the machine. + Prebuild_availability string `json:"prebuild_availability"` // Whether a prebuild is currently available when creating a codespace for this machine and repository. If a branch was not specified as a ref, the default branch will be assumed. Value will be "null" if prebuilds are not supported or prebuild availability could not be determined. Value will be "none" if no prebuild is available. Latest values "ready" and "in_progress" indicate the prebuild availability status. + Storage_in_bytes int `json:"storage_in_bytes"` // How much storage is available to the codespace. + Cpus int `json:"cpus"` // How many cores are available to the codespace. + Display_name string `json:"display_name"` // The display name of the machine includes cores, memory, and storage. + Memory_in_bytes int `json:"memory_in_bytes"` // How much memory is available to the codespace. + Name string `json:"name"` // The name of the machine. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Ref_type string `json:"ref_type"` // The type of Git ref object created in the repository. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Pusher_type string `json:"pusher_type"` // The pusher type for the event. Can be either `user` or a deploy key. - Ref string `json:"ref"` // The [`git ref`](https://docs.github.com/rest/git/refs#get-a-reference) resource. - Sender GeneratedType `json:"sender"` // A GitHub user. - Description string `json:"description"` // The repository's current description. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Master_branch string `json:"master_branch"` // The name of the repository's default branch (usually `main`). +// GeneratedType_Webhook_membership_added represents the GeneratedType_Webhook_membership_added schema from the OpenAPI specification +type GeneratedType_Webhook_membership_added struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Member Webhooksuser `json:"member"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sender map[string]interface{} `json:"sender"` + Scope string `json:"scope"` // The scope of the membership. Currently, can only be `team`. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Team Webhooksteam `json:"team"` // Groups of organization members that gives permissions on specified repositories. + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Block_creations map[string]interface{} `json:"block_creations,omitempty"` - Enforce_admins GeneratedType `json:"enforce_admins,omitempty"` // Protected Branch Admin Enforced - Name string `json:"name,omitempty"` - Url string `json:"url,omitempty"` - Allow_deletions map[string]interface{} `json:"allow_deletions,omitempty"` - Allow_fork_syncing map[string]interface{} `json:"allow_fork_syncing,omitempty"` // Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow fork syncing. Set to `false` to prevent fork syncing. - Required_conversation_resolution map[string]interface{} `json:"required_conversation_resolution,omitempty"` - Protection_url string `json:"protection_url,omitempty"` - Required_status_checks GeneratedType `json:"required_status_checks,omitempty"` // Protected Branch Required Status Check - Enabled bool `json:"enabled,omitempty"` - Restrictions GeneratedType `json:"restrictions,omitempty"` // Branch Restriction Policy - Required_pull_request_reviews GeneratedType `json:"required_pull_request_reviews,omitempty"` // Protected Branch Pull Request Review - Allow_force_pushes map[string]interface{} `json:"allow_force_pushes,omitempty"` - Required_linear_history map[string]interface{} `json:"required_linear_history,omitempty"` - Required_signatures map[string]interface{} `json:"required_signatures,omitempty"` - Lock_branch map[string]interface{} `json:"lock_branch,omitempty"` // Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. +// GeneratedType_Webhook_secret_scanning_alert_resolved represents the GeneratedType_Webhook_secret_scanning_alert_resolved schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_resolved struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Alert GeneratedType_Secret_scanning_alert_webhook `json:"alert"` } -// Vulnerability represents the Vulnerability schema from the OpenAPI specification -type Vulnerability struct { - First_patched_version string `json:"first_patched_version"` // The package version that resolves the vulnerability. - PackageField map[string]interface{} `json:"package"` // The name of the package affected by the vulnerability. - Vulnerable_functions []string `json:"vulnerable_functions"` // The functions in the package that are affected by the vulnerability. - Vulnerable_version_range string `json:"vulnerable_version_range"` // The range of the package versions affected by the vulnerability. +// GeneratedType_Copilot_ide_code_completions represents the GeneratedType_Copilot_ide_code_completions schema from the OpenAPI specification +type GeneratedType_Copilot_ide_code_completions struct { + Editors []map[string]interface{} `json:"editors,omitempty"` + Languages []map[string]interface{} `json:"languages,omitempty"` // Code completion metrics for active languages. + Total_engaged_users int `json:"total_engaged_users,omitempty"` // Number of users who accepted at least one Copilot code suggestion, across all active editors. Includes both full and partial acceptances. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Secret_scanning_location_pull_request_review represents the GeneratedType_Secret_scanning_location_pull_request_review schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_pull_request_review struct { + Pull_request_review_url string `json:"pull_request_review_url"` // The API URL to get the pull request review where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Description string `json:"description,omitempty"` // Description of the issue type. - Is_enabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. - Name string `json:"name"` // Name of the issue type. - Color string `json:"color,omitempty"` // Color for the issue type. +// Topic represents the Topic schema from the OpenAPI specification +type Topic struct { + Names []string `json:"names"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Status_url string `json:"status_url"` // The URI to monitor GitHub Pages deployment status. - Id string `json:"id"` // The ID of the GitHub Pages deployment. This is the Git SHA of the deployed commit. - Page_url string `json:"page_url"` // The URI to the deployed GitHub Pages. - Preview_url string `json:"preview_url,omitempty"` // The URI to the deployed GitHub Pages preview. +// GeneratedType_Webhook_marketplace_purchase_changed represents the GeneratedType_Webhook_marketplace_purchase_changed schema from the OpenAPI specification +type GeneratedType_Webhook_marketplace_purchase_changed struct { + Effective_date string `json:"effective_date"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` + Previous_marketplace_purchase map[string]interface{} `json:"previous_marketplace_purchase,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_installation_unsuspend represents the GeneratedType_Webhook_installation_unsuspend schema from the OpenAPI specification +type GeneratedType_Webhook_installation_unsuspend struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requester interface{} `json:"requester,omitempty"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Rule Webhooksrule `json:"rule"` // The branch protection rule. Includes a `name` and all the [branch protection settings](https://docs.github.com/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-settings) applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of `off`, `non_admins`, or `everyone`. Actor and build lists are arrays of strings. - Sender GeneratedType `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation Installation `json:"installation"` // Installation } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Updated_at string `json:"updated_at"` - Created_at string `json:"created_at"` - Name string `json:"name"` // The name of the secret. +// GeneratedType_Code_scanning_analysis represents the GeneratedType_Code_scanning_analysis schema from the OpenAPI specification +type GeneratedType_Code_scanning_analysis struct { + Rules_count int `json:"rules_count"` // The total number of rules used in the analysis. + Url string `json:"url"` // The REST API URL of the analysis resource. + Category string `json:"category,omitempty"` // Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code. + Id int `json:"id"` // Unique identifier for this analysis. + Environment string `json:"environment"` // Identifies the variable values associated with the environment in which this analysis was performed. + Ref string `json:"ref"` // The Git reference, formatted as `refs/pull//merge`, `refs/pull//head`, `refs/heads/` or simply ``. + Results_count int `json:"results_count"` // The total number of results in the analysis. + ErrorField string `json:"error"` + Deletable bool `json:"deletable"` + Sarif_id string `json:"sarif_id"` // An identifier for the upload. + Commit_sha string `json:"commit_sha"` // The SHA of the commit to which the analysis you are uploading relates. + Created_at string `json:"created_at"` // The time that the analysis was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Tool GeneratedType_Code_scanning_analysis_tool `json:"tool"` + Analysis_key string `json:"analysis_key"` // Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. + Warning string `json:"warning"` // Warning generated when processing the analysis } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_id string `json:"commit_id"` - Created_at string `json:"created_at"` - Url string `json:"url"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Node_id string `json:"node_id"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Commit_url string `json:"commit_url"` - Event string `json:"event"` +// Artifact represents the Artifact schema from the OpenAPI specification +type Artifact struct { + Digest string `json:"digest,omitempty"` // The SHA256 digest of the artifact. This field will only be populated on artifacts uploaded with upload-artifact v4 or newer. For older versions, this field will be null. + Expired bool `json:"expired"` // Whether or not the artifact has expired. Id int `json:"id"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` - Issues_url string `json:"issues_url"` - Svn_url string `json:"svn_url"` - Blobs_url string `json:"blobs_url"` - Teams_url string `json:"teams_url"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` - Collaborators_url string `json:"collaborators_url"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Html_url string `json:"html_url"` - Ssh_url string `json:"ssh_url"` - Statuses_url string `json:"statuses_url"` - Keys_url string `json:"keys_url"` - Master_branch string `json:"master_branch,omitempty"` - Git_refs_url string `json:"git_refs_url"` - Open_issues_count int `json:"open_issues_count"` - Releases_url string `json:"releases_url"` - Comments_url string `json:"comments_url"` - Stargazers_url string `json:"stargazers_url"` - Open_issues int `json:"open_issues"` - Contents_url string `json:"contents_url"` - Branches_url string `json:"branches_url"` Node_id string `json:"node_id"` - Languages_url string `json:"languages_url"` - Tags_url string `json:"tags_url"` - Contributors_url string `json:"contributors_url"` - Deployments_url string `json:"deployments_url"` - License GeneratedType `json:"license"` // License Simple - Hooks_url string `json:"hooks_url"` - Has_issues bool `json:"has_issues"` - Trees_url string `json:"trees_url"` - Description string `json:"description"` - Archived bool `json:"archived"` - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` - Has_downloads bool `json:"has_downloads"` - Pulls_url string `json:"pulls_url"` - Has_discussions bool `json:"has_discussions,omitempty"` - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` - Issue_comment_url string `json:"issue_comment_url"` - Subscribers_url string `json:"subscribers_url"` - Created_at string `json:"created_at"` - Git_url string `json:"git_url"` - Clone_url string `json:"clone_url"` - Full_name string `json:"full_name"` - Name string `json:"name"` - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` - Archive_url string `json:"archive_url"` - Language string `json:"language"` - Owner GeneratedType `json:"owner"` // A GitHub user. - Issue_events_url string `json:"issue_events_url"` - Mirror_url string `json:"mirror_url"` - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` - Forks int `json:"forks"` - Id int `json:"id"` - Notifications_url string `json:"notifications_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` - Score float64 `json:"score"` - Watchers_count int `json:"watchers_count"` - Merges_url string `json:"merges_url"` + Expires_at string `json:"expires_at"` + Name string `json:"name"` // The name of the artifact. Updated_at string `json:"updated_at"` - Is_template bool `json:"is_template,omitempty"` - Downloads_url string `json:"downloads_url"` - Forks_count int `json:"forks_count"` - Commits_url string `json:"commits_url"` - Pushed_at string `json:"pushed_at"` - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. - Git_commits_url string `json:"git_commits_url"` - Topics []string `json:"topics,omitempty"` - Git_tags_url string `json:"git_tags_url"` - Allow_forking bool `json:"allow_forking,omitempty"` - Size int `json:"size"` - Compare_url string `json:"compare_url"` - Fork bool `json:"fork"` - Subscription_url string `json:"subscription_url"` - Has_pages bool `json:"has_pages"` - Has_wiki bool `json:"has_wiki"` - Events_url string `json:"events_url"` - Stargazers_count int `json:"stargazers_count"` - Has_projects bool `json:"has_projects"` - Homepage string `json:"homepage"` + Archive_download_url string `json:"archive_download_url"` + Size_in_bytes int `json:"size_in_bytes"` // The size in bytes of the artifact. + Workflow_run map[string]interface{} `json:"workflow_run,omitempty"` Url string `json:"url"` - Private bool `json:"private"` - Default_branch string `json:"default_branch"` - Labels_url string `json:"labels_url"` - Milestones_url string `json:"milestones_url"` - Forks_url string `json:"forks_url"` - Watchers int `json:"watchers"` - Assignees_url string `json:"assignees_url"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Payload string `json:"payload"` // A URL-encoded string of the ping JSON payload. The decoded payload is a JSON object. +// GeneratedType_Webhook_repository_deleted represents the GeneratedType_Webhook_repository_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_repository_deleted struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Subscribed bool `json:"subscribed"` - Thread_url string `json:"thread_url,omitempty"` - Url string `json:"url"` - Created_at string `json:"created_at"` - Ignored bool `json:"ignored"` - Reason string `json:"reason"` - Repository_url string `json:"repository_url,omitempty"` +// GeneratedType_Webhook_projects_v2_project_reopened represents the GeneratedType_Webhook_projects_v2_project_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_project_reopened struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2 GeneratedType_Projects_v2 `json:"projects_v2"` // A projects v2 project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Filename string `json:"filename"` - Os string `json:"os"` - Sha256_checksum string `json:"sha256_checksum,omitempty"` - Temp_download_token string `json:"temp_download_token,omitempty"` // A short lived bearer token used to download the runner, if needed. - Architecture string `json:"architecture"` - Download_url string `json:"download_url"` +// GeneratedType_Webhook_project_column_edited represents the GeneratedType_Webhook_project_column_edited schema from the OpenAPI specification +type GeneratedType_Webhook_project_column_edited struct { + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_column Webhooksprojectcolumn `json:"project_column"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Href string `json:"href"` +// GeneratedType_Repository_rule_merge_queue represents the GeneratedType_Repository_rule_merge_queue schema from the OpenAPI specification +type GeneratedType_Repository_rule_merge_queue struct { TypeField string `json:"type"` + Parameters map[string]interface{} `json:"parameters,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_secret_scanning_alert_validated represents the GeneratedType_Webhook_secret_scanning_alert_validated schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_validated struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Alert GeneratedType `json:"alert"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Alert GeneratedType_Secret_scanning_alert_webhook `json:"alert"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Timeline_cross_referenced_event represents the GeneratedType_Timeline_cross_referenced_event schema from the OpenAPI specification +type GeneratedType_Timeline_cross_referenced_event struct { + Source map[string]interface{} `json:"source"` + Updated_at string `json:"updated_at"` + Actor GeneratedType_Simple_user `json:"actor,omitempty"` // A GitHub user. + Created_at string `json:"created_at"` + Event string `json:"event"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Included_minutes int `json:"included_minutes"` // The amount of free GitHub Actions minutes available. - Minutes_used_breakdown map[string]interface{} `json:"minutes_used_breakdown"` - Total_minutes_used int `json:"total_minutes_used"` // The sum of the free and paid GitHub Actions minutes used. - Total_paid_minutes_used int `json:"total_paid_minutes_used"` // The total paid GitHub Actions minutes used. +// GeneratedType_Webhook_deploy_key_deleted represents the GeneratedType_Webhook_deploy_key_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_deploy_key_deleted struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Key Webhooksdeploykey `json:"key"` // The [`deploy key`](https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key) resource. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Apps []map[string]interface{} `json:"apps"` - Apps_url string `json:"apps_url"` - Teams []map[string]interface{} `json:"teams"` - Teams_url string `json:"teams_url"` - Url string `json:"url"` - Users []map[string]interface{} `json:"users"` - Users_url string `json:"users_url"` +// GeneratedType_Webhook_pull_request_review_edited represents the GeneratedType_Webhook_pull_request_review_edited schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_edited struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Review Webhooksreview `json:"review"` // The review that was affected. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Changes map[string]interface{} `json:"changes"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Hooks_url string `json:"hooks_url"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Name string `json:"name"` // The name of the repository. - Git_tags_url string `json:"git_tags_url"` - Compare_url string `json:"compare_url"` - Issue_comment_url string `json:"issue_comment_url"` - License GeneratedType `json:"license"` // License Simple - Clone_url string `json:"clone_url"` - Has_issues bool `json:"has_issues"` // Whether issues are enabled. - Commits_url string `json:"commits_url"` - Pulls_url string `json:"pulls_url"` - Tags_url string `json:"tags_url"` - Archive_url string `json:"archive_url"` - Id int64 `json:"id"` // Unique identifier of the repository - Topics []string `json:"topics,omitempty"` - Git_refs_url string `json:"git_refs_url"` - Issues_url string `json:"issues_url"` - Releases_url string `json:"releases_url"` - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. - Notifications_url string `json:"notifications_url"` - Description string `json:"description"` - Code_search_index_status map[string]interface{} `json:"code_search_index_status,omitempty"` // The status of the code search index for this repository - Deployments_url string `json:"deployments_url"` - Forks int `json:"forks"` - Watchers_count int `json:"watchers_count"` - Trees_url string `json:"trees_url"` - Merges_url string `json:"merges_url"` - Stargazers_count int `json:"stargazers_count"` - Labels_url string `json:"labels_url"` - Homepage string `json:"homepage"` - Ssh_url string `json:"ssh_url"` +// GeneratedType_Git_ref represents the GeneratedType_Git_ref schema from the OpenAPI specification +type GeneratedType_Git_ref struct { Node_id string `json:"node_id"` - Languages_url string `json:"languages_url"` - Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo - Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. - Events_url string `json:"events_url"` - Owner GeneratedType `json:"owner"` // A GitHub user. - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged - Full_name string `json:"full_name"` - Watchers int `json:"watchers"` - Updated_at string `json:"updated_at"` - Fork bool `json:"fork"` - Master_branch string `json:"master_branch,omitempty"` - Blobs_url string `json:"blobs_url"` - Teams_url string `json:"teams_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. - Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. - Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. - Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. - Created_at string `json:"created_at"` - Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Subscription_url string `json:"subscription_url"` - Statuses_url string `json:"statuses_url"` - Language string `json:"language"` - Has_projects bool `json:"has_projects"` // Whether projects are enabled. - Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. - Comments_url string `json:"comments_url"` - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. - Milestones_url string `json:"milestones_url"` - Contents_url string `json:"contents_url"` - Stargazers_url string `json:"stargazers_url"` - Mirror_url string `json:"mirror_url"` - Private bool `json:"private"` // Whether the repository is private or public. - Assignees_url string `json:"assignees_url"` - Default_branch string `json:"default_branch"` // The default branch of the repository. - Forks_count int `json:"forks_count"` - Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. - Keys_url string `json:"keys_url"` - Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. - Pushed_at string `json:"pushed_at"` - Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository - Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). - Git_url string `json:"git_url"` - Git_commits_url string `json:"git_commits_url"` - Collaborators_url string `json:"collaborators_url"` - Open_issues_count int `json:"open_issues_count"` - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. - Html_url string `json:"html_url"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Subscribers_url string `json:"subscribers_url"` - Has_pages bool `json:"has_pages"` - Issue_events_url string `json:"issue_events_url"` - Branches_url string `json:"branches_url"` - Starred_at string `json:"starred_at,omitempty"` - Forks_url string `json:"forks_url"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits - Open_issues int `json:"open_issues"` - Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. - Contributors_url string `json:"contributors_url"` + Object map[string]interface{} `json:"object"` + Ref string `json:"ref"` Url string `json:"url"` - Downloads_url string `json:"downloads_url"` - Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). - Svn_url string `json:"svn_url"` - Archived bool `json:"archived"` // Whether the repository is archived. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization_events string `json:"organization_events,omitempty"` // The level of permission to grant the access token to view events triggered by an activity in an organization. - Organization_secrets string `json:"organization_secrets,omitempty"` // The level of permission to grant the access token to manage organization secrets. - Starring string `json:"starring,omitempty"` // The level of permission to grant the access token to list and manage repositories a user is starring. - Followers string `json:"followers,omitempty"` // The level of permission to grant the access token to manage the followers belonging to a user. - Members string `json:"members,omitempty"` // The level of permission to grant the access token for organization teams and members. - Organization_personal_access_token_requests string `json:"organization_personal_access_token_requests,omitempty"` // The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization. - Issues string `json:"issues,omitempty"` // The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. - Organization_packages string `json:"organization_packages,omitempty"` // The level of permission to grant the access token for organization packages published to GitHub Packages. - Pull_requests string `json:"pull_requests,omitempty"` // The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. - Single_file string `json:"single_file,omitempty"` // The level of permission to grant the access token to manage just a single file. - Organization_personal_access_tokens string `json:"organization_personal_access_tokens,omitempty"` // The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization. - Team_discussions string `json:"team_discussions,omitempty"` // The level of permission to grant the access token to manage team discussions and related comments. - Deployments string `json:"deployments,omitempty"` // The level of permission to grant the access token for deployments and deployment statuses. - Organization_administration string `json:"organization_administration,omitempty"` // The level of permission to grant the access token to manage access to an organization. - Security_events string `json:"security_events,omitempty"` // The level of permission to grant the access token to view and manage security events like code scanning alerts. - Checks string `json:"checks,omitempty"` // The level of permission to grant the access token for checks on code. - Vulnerability_alerts string `json:"vulnerability_alerts,omitempty"` // The level of permission to grant the access token to manage Dependabot alerts. - Workflows string `json:"workflows,omitempty"` // The level of permission to grant the access token to update GitHub Actions workflow files. - Organization_custom_properties string `json:"organization_custom_properties,omitempty"` // The level of permission to grant the access token for custom property management. - Interaction_limits string `json:"interaction_limits,omitempty"` // The level of permission to grant the access token to view and manage interaction limits on a repository. - Organization_hooks string `json:"organization_hooks,omitempty"` // The level of permission to grant the access token to manage the post-receive hooks for an organization. - Secrets string `json:"secrets,omitempty"` // The level of permission to grant the access token to manage repository secrets. - Repository_projects string `json:"repository_projects,omitempty"` // The level of permission to grant the access token to manage repository projects, columns, and cards. - Organization_projects string `json:"organization_projects,omitempty"` // The level of permission to grant the access token to manage organization projects and projects public preview (where available). - Organization_user_blocking string `json:"organization_user_blocking,omitempty"` // The level of permission to grant the access token to view and manage users blocked by the organization. - Metadata string `json:"metadata,omitempty"` // The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. - Repository_custom_properties string `json:"repository_custom_properties,omitempty"` // The level of permission to grant the access token to view and edit custom properties for a repository, when allowed by the property. - Dependabot_secrets string `json:"dependabot_secrets,omitempty"` // The level of permission to grant the access token to manage Dependabot secrets. - Organization_custom_org_roles string `json:"organization_custom_org_roles,omitempty"` // The level of permission to grant the access token for custom organization roles management. - Organization_copilot_seat_management string `json:"organization_copilot_seat_management,omitempty"` // The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change. - Organization_plan string `json:"organization_plan,omitempty"` // The level of permission to grant the access token for viewing an organization's plan. - Profile string `json:"profile,omitempty"` // The level of permission to grant the access token to manage the profile settings belonging to a user. - Gpg_keys string `json:"gpg_keys,omitempty"` // The level of permission to grant the access token to view and manage GPG keys belonging to a user. - Email_addresses string `json:"email_addresses,omitempty"` // The level of permission to grant the access token to manage the email addresses belonging to a user. - Organization_self_hosted_runners string `json:"organization_self_hosted_runners,omitempty"` // The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. - Packages string `json:"packages,omitempty"` // The level of permission to grant the access token for packages published to GitHub Packages. - Administration string `json:"administration,omitempty"` // The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. - Contents string `json:"contents,omitempty"` // The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. - Repository_hooks string `json:"repository_hooks,omitempty"` // The level of permission to grant the access token to manage the post-receive hooks for a repository. - Statuses string `json:"statuses,omitempty"` // The level of permission to grant the access token for commit statuses. - Organization_custom_roles string `json:"organization_custom_roles,omitempty"` // The level of permission to grant the access token for custom repository roles management. - Codespaces string `json:"codespaces,omitempty"` // The level of permission to grant the access token to create, edit, delete, and list Codespaces. - Git_ssh_keys string `json:"git_ssh_keys,omitempty"` // The level of permission to grant the access token to manage git SSH keys. - Secret_scanning_alerts string `json:"secret_scanning_alerts,omitempty"` // The level of permission to grant the access token to view and manage secret scanning alerts. - Actions string `json:"actions,omitempty"` // The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. - Environments string `json:"environments,omitempty"` // The level of permission to grant the access token for managing repository environments. - Pages string `json:"pages,omitempty"` // The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. - Organization_announcement_banners string `json:"organization_announcement_banners,omitempty"` // The level of permission to grant the access token to view and manage announcement banners for an organization. +// GeneratedType_Webhook_milestone_opened represents the GeneratedType_Webhook_milestone_opened schema from the OpenAPI specification +type GeneratedType_Webhook_milestone_opened struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Milestone Webhooksmilestone3 `json:"milestone"` // A collection of related issues and pull requests. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Comment map[string]interface{} `json:"comment"` // The [commit comment](${externalDocsUpapp/api/description/components/schemas/webhooks/issue-comment-created.yamlrl}/rest/commits/comments#get-a-commit-comment) resource. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` // The action performed. Can be `created`. +// GeneratedType_Deployment_branch_policy_name_pattern represents the GeneratedType_Deployment_branch_policy_name_pattern schema from the OpenAPI specification +type GeneratedType_Deployment_branch_policy_name_pattern struct { + Name string `json:"name"` // The name pattern that branches must match in order to deploy to the environment. Wildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`. For more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch). } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Payload string `json:"payload"` // A URL-encoded string of the check_run.completed JSON payload. The decoded payload is a JSON object. +// GeneratedType_Global_advisory represents the GeneratedType_Global_advisory schema from the OpenAPI specification +type GeneratedType_Global_advisory struct { + Nvd_published_at string `json:"nvd_published_at"` // The date and time when the advisory was published in the National Vulnerability Database, in ISO 8601 format. This field is only populated when the advisory is imported from the National Vulnerability Database. + References []string `json:"references"` + Url string `json:"url"` // The API URL for the advisory. + Html_url string `json:"html_url"` // The URL for the advisory. + Updated_at string `json:"updated_at"` // The date and time of when the advisory was last updated, in ISO 8601 format. + Cve_id string `json:"cve_id"` // The Common Vulnerabilities and Exposures (CVE) ID. + Identifiers []map[string]interface{} `json:"identifiers"` + Source_code_location string `json:"source_code_location"` // The URL of the advisory's source code. + Epss GeneratedType_Security_advisory_epss `json:"epss,omitempty"` // The EPSS scores as calculated by the [Exploit Prediction Scoring System](https://www.first.org/epss). + Ghsa_id string `json:"ghsa_id"` // The GitHub Security Advisory ID. + Cvss map[string]interface{} `json:"cvss"` + Repository_advisory_url string `json:"repository_advisory_url"` // The API URL for the repository advisory. + Summary string `json:"summary"` // A short summary of the advisory. + Cwes []map[string]interface{} `json:"cwes"` + Description string `json:"description"` // A detailed description of what the advisory entails. + Published_at string `json:"published_at"` // The date and time of when the advisory was published, in ISO 8601 format. + TypeField string `json:"type"` // The type of advisory. + Credits []map[string]interface{} `json:"credits"` // The users who contributed to the advisory. + Cvss_severities GeneratedType_Cvss_severities `json:"cvss_severities,omitempty"` + Github_reviewed_at string `json:"github_reviewed_at"` // The date and time of when the advisory was reviewed by GitHub, in ISO 8601 format. + Severity string `json:"severity"` // The severity of the advisory. + Vulnerabilities []Vulnerability `json:"vulnerabilities"` // The products and respective version ranges affected by the advisory. + Withdrawn_at string `json:"withdrawn_at"` // The date and time of when the advisory was withdrawn, in ISO 8601 format. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Changes map[string]interface{} `json:"changes,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Membership Webhooksmembership `json:"membership,omitempty"` // The membership between the user and the organization. Not present when the action is `member_invited`. - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// Language represents the Language schema from the OpenAPI specification +type Language struct { } -// Webhookspullrequest5 represents the Webhookspullrequest5 schema from the OpenAPI specification -type Webhookspullrequest5 struct { - Closed_at string `json:"closed_at"` - Review_comments_url string `json:"review_comments_url"` - Requested_reviewers []interface{} `json:"requested_reviewers"` - Mergeable_state string `json:"mergeable_state,omitempty"` - Merged bool `json:"merged,omitempty"` - Additions int `json:"additions,omitempty"` - Number int `json:"number"` // Number uniquely identifying the pull request within its repository. - Merge_commit_sha string `json:"merge_commit_sha"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Updated_at string `json:"updated_at"` - Body string `json:"body"` - User map[string]interface{} `json:"user"` - Deletions int `json:"deletions,omitempty"` - Issue_url string `json:"issue_url"` - Head map[string]interface{} `json:"head"` - Statuses_url string `json:"statuses_url"` - Assignee map[string]interface{} `json:"assignee"` - Rebaseable bool `json:"rebaseable,omitempty"` - Draft bool `json:"draft"` // Indicates whether or not the pull request is a draft. - Mergeable bool `json:"mergeable,omitempty"` - Links map[string]interface{} `json:"_links"` - Locked bool `json:"locked"` - Merged_by map[string]interface{} `json:"merged_by,omitempty"` - State string `json:"state"` // State of this Pull Request. Either `open` or `closed`. - Labels []map[string]interface{} `json:"labels"` - Html_url string `json:"html_url"` - Commits_url string `json:"commits_url"` - Patch_url string `json:"patch_url"` - Diff_url string `json:"diff_url"` - Id int `json:"id"` - Requested_teams []map[string]interface{} `json:"requested_teams"` - Review_comment_url string `json:"review_comment_url"` - Commits int `json:"commits,omitempty"` - Created_at string `json:"created_at"` - Active_lock_reason string `json:"active_lock_reason"` - Comments int `json:"comments,omitempty"` - Merged_at string `json:"merged_at"` - Title string `json:"title"` // The title of the pull request. - Comments_url string `json:"comments_url"` - Milestone map[string]interface{} `json:"milestone"` // A collection of related issues and pull requests. - Assignees []map[string]interface{} `json:"assignees"` - Url string `json:"url"` - Changed_files int `json:"changed_files,omitempty"` - Review_comments int `json:"review_comments,omitempty"` - Maintainer_can_modify bool `json:"maintainer_can_modify,omitempty"` // Indicates whether maintainers can modify the pull request. - Auto_merge map[string]interface{} `json:"auto_merge"` // The status of auto merging a pull request. - Base map[string]interface{} `json:"base"` - Node_id string `json:"node_id"` +// GeneratedType_Issue_event_label represents the GeneratedType_Issue_event_label schema from the OpenAPI specification +type GeneratedType_Issue_event_label struct { + Color string `json:"color"` + Name string `json:"name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_workflow_job_in_progress represents the GeneratedType_Webhook_workflow_job_in_progress schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_job_in_progress struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow_job interface{} `json:"workflow_job"` Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Count int `json:"count"` - Path string `json:"path"` - Title string `json:"title"` - Uniques int `json:"uniques"` +// Webhooksmarketplacepurchase represents the Webhooksmarketplacepurchase schema from the OpenAPI specification +type Webhooksmarketplacepurchase struct { + Next_billing_date string `json:"next_billing_date"` + On_free_trial bool `json:"on_free_trial"` + Plan map[string]interface{} `json:"plan"` + Unit_count int `json:"unit_count"` + Account map[string]interface{} `json:"account"` + Billing_cycle string `json:"billing_cycle"` + Free_trial_ends_on string `json:"free_trial_ends_on"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Access_level string `json:"access_level"` // Defines the level of access that workflows outside of the repository have to actions and reusable workflows within the repository. `none` means the access is only possible from workflows in this repository. `user` level access allows sharing across user owned private repositories only. `organization` level access allows sharing across the organization. +// GeneratedType_Webhook_organization_member_invited represents the GeneratedType_Webhook_organization_member_invited schema from the OpenAPI specification +type GeneratedType_Webhook_organization_member_invited struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + User Webhooksuser `json:"user,omitempty"` + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Invitation map[string]interface{} `json:"invitation"` // The invitation for the user or email if the action is `member_invited`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_sponsorship_edited represents the GeneratedType_Webhook_sponsorship_edited schema from the OpenAPI specification +type GeneratedType_Webhook_sponsorship_edited struct { Action string `json:"action"` Changes map[string]interface{} `json:"changes"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Sponsorship Webhookssponsorship `json:"sponsorship"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the secret. - Selected_repositories_url string `json:"selected_repositories_url,omitempty"` +// GeneratedType_Enterprise_team represents the GeneratedType_Enterprise_team schema from the OpenAPI specification +type GeneratedType_Enterprise_team struct { + Group_id string `json:"group_id,omitempty"` + Name string `json:"name"` + Sync_to_organizations string `json:"sync_to_organizations,omitempty"` Updated_at string `json:"updated_at"` - Visibility string `json:"visibility"` // Visibility of a secret Created_at string `json:"created_at"` + Id int64 `json:"id"` + Members_url string `json:"members_url"` + Organization_selection_type string `json:"organization_selection_type,omitempty"` + Slug string `json:"slug"` + Group_name string `json:"group_name,omitempty"` + Html_url string `json:"html_url"` + Description string `json:"description,omitempty"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request_review_url string `json:"pull_request_review_url"` // The API URL to get the pull request review where the secret was detected. +// GeneratedType_Classroom_assignment represents the GeneratedType_Classroom_assignment schema from the OpenAPI specification +type GeneratedType_Classroom_assignment struct { + Invite_link string `json:"invite_link"` // The link that a student can use to accept the assignment. + Max_members int `json:"max_members"` // The maximum allowable members per team. + Max_teams int `json:"max_teams"` // The maximum allowable teams for the assignment. + Deadline string `json:"deadline"` // The time at which the assignment is due. + Public_repo bool `json:"public_repo"` // Whether an accepted assignment creates a public repository. + TypeField string `json:"type"` // Whether it's a group assignment or individual assignment. + Editor string `json:"editor"` // The selected editor for the assignment. + Students_are_repo_admins bool `json:"students_are_repo_admins"` // Whether students are admins on created repository when a student accepts the assignment. + Feedback_pull_requests_enabled bool `json:"feedback_pull_requests_enabled"` // Whether feedback pull request will be created when a student accepts the assignment. + Invitations_enabled bool `json:"invitations_enabled"` // Whether the invitation link is enabled. Visiting an enabled invitation link will accept the assignment. + Submitted int `json:"submitted"` // The number of students that have submitted the assignment. + Title string `json:"title"` // Assignment title. + Starter_code_repository GeneratedType_Simple_classroom_repository `json:"starter_code_repository"` // A GitHub repository view for Classroom + Accepted int `json:"accepted"` // The number of students that have accepted the assignment. + Classroom Classroom `json:"classroom"` // A GitHub Classroom classroom + Language string `json:"language"` // The programming language used in the assignment. + Id int `json:"id"` // Unique identifier of the repository. + Slug string `json:"slug"` // Sluggified name of the assignment. + Passing int `json:"passing"` // The number of students that have passed the assignment. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_issues_unpinned represents the GeneratedType_Webhook_issues_unpinned schema from the OpenAPI specification +type GeneratedType_Webhook_issues_unpinned struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue Webhooksissue2 `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Assignee Webhooksusermannequin `json:"assignee,omitempty"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pages []map[string]interface{} `json:"pages"` // The pages that were updated. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_repository_edited represents the GeneratedType_Webhook_repository_edited schema from the OpenAPI specification +type GeneratedType_Webhook_repository_edited struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id string `json:"id,omitempty"` // An identifier for the upload. - Url string `json:"url,omitempty"` // The REST API URL for checking the status of the upload. +// GeneratedType_Packages_billing_usage represents the GeneratedType_Packages_billing_usage schema from the OpenAPI specification +type GeneratedType_Packages_billing_usage struct { + Total_gigabytes_bandwidth_used int `json:"total_gigabytes_bandwidth_used"` // Sum of the free and paid storage space (GB) for GitHuub Packages. + Total_paid_gigabytes_bandwidth_used int `json:"total_paid_gigabytes_bandwidth_used"` // Total paid storage space (GB) for GitHuub Packages. + Included_gigabytes_bandwidth int `json:"included_gigabytes_bandwidth"` // Free storage space (GB) for GitHub Packages. } -// Codespace represents the Codespace schema from the OpenAPI specification -type Codespace struct { - Idle_timeout_minutes int `json:"idle_timeout_minutes"` // The number of minutes of inactivity after which this codespace will be automatically stopped. - Idle_timeout_notice string `json:"idle_timeout_notice,omitempty"` // Text to show user when codespace idle timeout minutes has been overriden by an organization policy - Environment_id string `json:"environment_id"` // UUID identifying this codespace's environment. - Machines_url string `json:"machines_url"` // API URL to access available alternate machine types for this codespace. - Last_used_at string `json:"last_used_at"` // Last known time this codespace was started. - Url string `json:"url"` // API URL for this codespace. - Owner GeneratedType `json:"owner"` // A GitHub user. - Recent_folders []string `json:"recent_folders"` - Display_name string `json:"display_name,omitempty"` // Display name for this codespace. - Publish_url string `json:"publish_url,omitempty"` // API URL to publish this codespace to a new repository. - Updated_at string `json:"updated_at"` - Pending_operation_disabled_reason string `json:"pending_operation_disabled_reason,omitempty"` // Text to show user when codespace is disabled by a pending operation - Runtime_constraints map[string]interface{} `json:"runtime_constraints,omitempty"` - Web_url string `json:"web_url"` // URL to access this codespace on the web. - Retention_period_minutes int `json:"retention_period_minutes,omitempty"` // Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). - Machine GeneratedType `json:"machine"` // A description of the machine powering a codespace. - Id int64 `json:"id"` - Name string `json:"name"` // Automatically generated name of this codespace. - Last_known_stop_notice string `json:"last_known_stop_notice,omitempty"` // The text to display to a user when a codespace has been stopped for a potentially actionable reason. - Devcontainer_path string `json:"devcontainer_path,omitempty"` // Path to devcontainer.json from repo root used to create Codespace. - Retention_expires_at string `json:"retention_expires_at,omitempty"` // When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at" - Billable_owner GeneratedType `json:"billable_owner"` // A GitHub user. - State string `json:"state"` // State of this codespace. - Repository GeneratedType `json:"repository"` // Minimal Repository - Prebuild bool `json:"prebuild"` // Whether the codespace was created from a prebuild. - Git_status map[string]interface{} `json:"git_status"` // Details about the codespace's git repository. - Start_url string `json:"start_url"` // API URL to start this codespace. - Pending_operation bool `json:"pending_operation,omitempty"` // Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it. - Stop_url string `json:"stop_url"` // API URL to stop this codespace. - Location string `json:"location"` // The initally assigned location of a new codespace. - Pulls_url string `json:"pulls_url"` // API URL for the Pull Request associated with this codespace, if any. - Created_at string `json:"created_at"` +// GeneratedType_Webhook_workflow_run_requested represents the GeneratedType_Webhook_workflow_run_requested schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_run_requested struct { + Workflow_run map[string]interface{} `json:"workflow_run"` + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow Webhooksworkflow `json:"workflow"` } -// Integration represents the Integration schema from the OpenAPI specification -type Integration struct { - Node_id string `json:"node_id"` - Permissions map[string]interface{} `json:"permissions"` // The set of permissions for the GitHub app - Events []string `json:"events"` // The list of events for the GitHub app. Note that the `installation_target`, `security_advisory`, and `meta` events are not included because they are global events and not specific to an installation. - External_url string `json:"external_url"` - Name string `json:"name"` // The name of the GitHub app - Client_id string `json:"client_id,omitempty"` - Html_url string `json:"html_url"` - Installations_count int `json:"installations_count,omitempty"` // The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself. - Owner interface{} `json:"owner"` - Slug string `json:"slug,omitempty"` // The slug name of the GitHub app - Created_at string `json:"created_at"` - Description string `json:"description"` - Updated_at string `json:"updated_at"` - Id int `json:"id"` // Unique identifier of the GitHub app +// GeneratedType_Simple_commit represents the GeneratedType_Simple_commit schema from the OpenAPI specification +type GeneratedType_Simple_commit struct { + Tree_id string `json:"tree_id"` // SHA for the commit's tree + Author map[string]interface{} `json:"author"` // Information about the Git author + Committer map[string]interface{} `json:"committer"` // Information about the Git committer + Id string `json:"id"` // SHA for the commit + Message string `json:"message"` // Message describing the purpose of the commit + Timestamp string `json:"timestamp"` // Timestamp of the commit } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at,omitempty"` +// Webhookspullrequest5 represents the Webhookspullrequest5 schema from the OpenAPI specification +type Webhookspullrequest5 struct { + Review_comments_url string `json:"review_comments_url"` + Mergeable_state string `json:"mergeable_state,omitempty"` + Locked bool `json:"locked"` + Updated_at string `json:"updated_at"` + Diff_url string `json:"diff_url"` + Additions int `json:"additions,omitempty"` + Statuses_url string `json:"statuses_url"` + Changed_files int `json:"changed_files,omitempty"` + Merged_by map[string]interface{} `json:"merged_by,omitempty"` + Patch_url string `json:"patch_url"` + Assignee map[string]interface{} `json:"assignee"` + Review_comments int `json:"review_comments,omitempty"` + Url string `json:"url"` + Requested_teams []map[string]interface{} `json:"requested_teams"` + Base map[string]interface{} `json:"base"` + Closed_at string `json:"closed_at"` + Auto_merge map[string]interface{} `json:"auto_merge"` // The status of auto merging a pull request. + Created_at string `json:"created_at"` + Milestone map[string]interface{} `json:"milestone"` // A collection of related issues and pull requests. + Body string `json:"body"` + Links map[string]interface{} `json:"_links"` + Comments_url string `json:"comments_url"` + Review_comment_url string `json:"review_comment_url"` + Commits int `json:"commits,omitempty"` + Requested_reviewers []interface{} `json:"requested_reviewers"` + Commits_url string `json:"commits_url"` + Mergeable bool `json:"mergeable,omitempty"` + Issue_url string `json:"issue_url"` + Rebaseable bool `json:"rebaseable,omitempty"` + Merged_at string `json:"merged_at"` + Html_url string `json:"html_url"` + State string `json:"state"` // State of this Pull Request. Either `open` or `closed`. + Title string `json:"title"` // The title of the pull request. + Head map[string]interface{} `json:"head"` Id int `json:"id"` - Key string `json:"key"` + Number int `json:"number"` // Number uniquely identifying the pull request within its repository. + Deletions int `json:"deletions,omitempty"` + Labels []map[string]interface{} `json:"labels"` + Node_id string `json:"node_id"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + Draft bool `json:"draft"` // Indicates whether or not the pull request is a draft. + Maintainer_can_modify bool `json:"maintainer_can_modify,omitempty"` // Indicates whether maintainers can modify the pull request. + User map[string]interface{} `json:"user"` + Merged bool `json:"merged,omitempty"` + Merge_commit_sha string `json:"merge_commit_sha"` + Comments int `json:"comments,omitempty"` + Active_lock_reason string `json:"active_lock_reason"` + Assignees []map[string]interface{} `json:"assignees"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Ignored bool `json:"ignored"` // Determines if all notifications should be blocked from this repository. - Reason string `json:"reason"` - Repository_url string `json:"repository_url"` - Subscribed bool `json:"subscribed"` // Determines if notifications should be received from this repository. - Url string `json:"url"` - Created_at string `json:"created_at"` +// GeneratedType_Dependabot_alert_package represents the GeneratedType_Dependabot_alert_package schema from the OpenAPI specification +type GeneratedType_Dependabot_alert_package struct { + Ecosystem string `json:"ecosystem"` // The package's language or package management ecosystem. + Name string `json:"name"` // The unique package name within its ecosystem. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request GeneratedType `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Secret_scanning_location_commit represents the GeneratedType_Secret_scanning_location_commit schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_commit struct { + Commit_url string `json:"commit_url"` // The API URL to get the associated commit resource + End_line float64 `json:"end_line"` // Line number at which the secret ends in the file + Start_column float64 `json:"start_column"` // The column at which the secret starts within the start line when the file is interpreted as 8BIT ASCII + Path string `json:"path"` // The file path in the repository + End_column float64 `json:"end_column"` // The column at which the secret ends within the end line when the file is interpreted as 8BIT ASCII + Start_line float64 `json:"start_line"` // Line number at which the secret starts in the file + Blob_sha string `json:"blob_sha"` // SHA-1 hash ID of the associated blob + Blob_url string `json:"blob_url"` // The API URL to get the associated blob resource + Commit_sha string `json:"commit_sha"` // SHA-1 hash ID of the associated commit } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_sub_issues_sub_issue_removed represents the GeneratedType_Webhook_sub_issues_sub_issue_removed schema from the OpenAPI specification +type GeneratedType_Webhook_sub_issues_sub_issue_removed struct { + Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Sub_issue_repo Repository `json:"sub_issue_repo"` // A repository on GitHub. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Sponsorship Webhookssponsorship `json:"sponsorship"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. + Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// Page represents the Page schema from the OpenAPI specification -type Page struct { - Html_url string `json:"html_url,omitempty"` // The web address the Page can be accessed from. - Https_certificate GeneratedType `json:"https_certificate,omitempty"` - Https_enforced bool `json:"https_enforced,omitempty"` // Whether https is enabled on the domain - Pending_domain_unverified_at string `json:"pending_domain_unverified_at,omitempty"` // The timestamp when a pending domain becomes unverified. - Public bool `json:"public"` // Whether the GitHub Pages site is publicly visible. If set to `true`, the site is accessible to anyone on the internet. If set to `false`, the site will only be accessible to users who have at least `read` access to the repository that published the site. - Source GeneratedType `json:"source,omitempty"` - Status string `json:"status"` // The status of the most recent build of the Page. - Url string `json:"url"` // The API address for accessing this Page resource. - Protected_domain_state string `json:"protected_domain_state,omitempty"` // The state if the domain is verified - Build_type string `json:"build_type,omitempty"` // The process in which the Page will be built. - Cname string `json:"cname"` // The Pages site's custom domain - Custom_404 bool `json:"custom_404"` // Whether the Page has a custom 404 page. +// GeneratedType_Network_settings represents the GeneratedType_Network_settings schema from the OpenAPI specification +type GeneratedType_Network_settings struct { + Id string `json:"id"` // The unique identifier of the network settings resource. + Name string `json:"name"` // The name of the network settings resource. + Network_configuration_id string `json:"network_configuration_id,omitempty"` // The identifier of the network configuration that is using this settings resource. + Region string `json:"region"` // The location of the subnet this network settings resource is configured for. + Subnet_id string `json:"subnet_id"` // The subnet this network settings resource is configured for. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Status string `json:"status,omitempty"` // The current status of the deployment. +// GeneratedType_Webhook_milestone_edited represents the GeneratedType_Webhook_milestone_edited schema from the OpenAPI specification +type GeneratedType_Webhook_milestone_edited struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` // The changes to the milestone if the action was `edited`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Payload string `json:"payload"` // A URL-encoded string of the check_run.created JSON payload. The decoded payload is a JSON object. +// GeneratedType_Webhook_fork represents the GeneratedType_Webhook_fork schema from the OpenAPI specification +type GeneratedType_Webhook_fork struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Forkee interface{} `json:"forkee"` // The created [`repository`](https://docs.github.com/rest/repos/repos#get-a-repository) resource. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Value_type string `json:"value_type"` // The type of the value for the property - Values_editable_by string `json:"values_editable_by,omitempty"` // Who can edit the values of the property - Allowed_values []string `json:"allowed_values,omitempty"` // An ordered list of the allowed values of the property. The property can have up to 200 allowed values. - Default_value string `json:"default_value,omitempty"` // Default value of the property - Description string `json:"description,omitempty"` // Short description of the property - Required bool `json:"required,omitempty"` // Whether the property is required. +// GeneratedType_Code_scanning_alert_rule_summary represents the GeneratedType_Code_scanning_alert_rule_summary schema from the OpenAPI specification +type GeneratedType_Code_scanning_alert_rule_summary struct { + Full_description string `json:"full_description,omitempty"` // A description of the rule used to detect the alert. + Help string `json:"help,omitempty"` // Detailed documentation for the rule as GitHub Flavored Markdown. + Help_uri string `json:"help_uri,omitempty"` // A link to the documentation for the rule used to detect the alert. + Id string `json:"id,omitempty"` // A unique identifier for the rule used to detect the alert. + Name string `json:"name,omitempty"` // The name of the rule used to detect the alert. + Severity string `json:"severity,omitempty"` // The severity of the alert. + Tags []string `json:"tags,omitempty"` // A set of tags applicable for the rule. + Description string `json:"description,omitempty"` // A short description of the rule used to detect the alert. + Security_severity_level string `json:"security_severity_level,omitempty"` // The security severity of the alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Membership Webhooksmembership `json:"membership,omitempty"` // The membership between the user and the organization. Not present when the action is `member_invited`. - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_secret_scanning_scan_completed represents the GeneratedType_Webhook_secret_scanning_scan_completed schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_scan_completed struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Secret_types []string `json:"secret_types,omitempty"` // List of patterns that were updated. This will be empty for normal backfill scans or custom pattern updates + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Source string `json:"source"` // What type of content was scanned + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + TypeField string `json:"type"` // What type of scan was completed Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Completed_at string `json:"completed_at"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Custom_pattern_name string `json:"custom_pattern_name,omitempty"` // If the scan was triggered by a custom pattern update, this will be the name of the pattern that was updated + Custom_pattern_scope string `json:"custom_pattern_scope,omitempty"` // If the scan was triggered by a custom pattern update, this will be the scope of the pattern that was updated + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Started_at string `json:"started_at"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Social_account represents the GeneratedType_Social_account schema from the OpenAPI specification +type GeneratedType_Social_account struct { + Provider string `json:"provider"` + Url string `json:"url"` } -// Snapshot represents the Snapshot schema from the OpenAPI specification -type Snapshot struct { - Metadata Metadata `json:"metadata,omitempty"` // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. - Ref string `json:"ref"` // The repository branch that triggered this snapshot. - Scanned string `json:"scanned"` // The time at which the snapshot was scanned. - Sha string `json:"sha"` // The commit SHA associated with this dependency snapshot. Maximum length: 40 characters. - Version int `json:"version"` // The version of the repository snapshot submission. - Detector map[string]interface{} `json:"detector"` // A description of the detector used. - Job map[string]interface{} `json:"job"` - Manifests map[string]interface{} `json:"manifests,omitempty"` // A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies. +// GeneratedType_Repository_ruleset_bypass_actor represents the GeneratedType_Repository_ruleset_bypass_actor schema from the OpenAPI specification +type GeneratedType_Repository_ruleset_bypass_actor struct { + Actor_id int `json:"actor_id,omitempty"` // The ID of the actor that can bypass a ruleset. If `actor_type` is `OrganizationAdmin`, this should be `1`. If `actor_type` is `DeployKey`, this should be null. `OrganizationAdmin` is not applicable for personal repositories. + Actor_type string `json:"actor_type"` // The type of actor that can bypass a ruleset. + Bypass_mode string `json:"bypass_mode,omitempty"` // When the specified actor can bypass the ruleset. `pull_request` means that an actor can only bypass rules on pull requests. `pull_request` is not applicable for the `DeployKey` actor type. Also, `pull_request` is only applicable to branch rulesets. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Platform_chat string `json:"platform_chat,omitempty"` // The organization policy for allowing or disallowing Copilot features on GitHub.com. - Public_code_suggestions string `json:"public_code_suggestions"` // The organization policy for allowing or blocking suggestions matching public code (duplication detection filter). - Seat_breakdown GeneratedType `json:"seat_breakdown"` // The breakdown of Copilot Business seats for the organization. - Seat_management_setting string `json:"seat_management_setting"` // The mode of assigning new seats. - Cli string `json:"cli,omitempty"` // The organization policy for allowing or disallowing Copilot in the CLI. - Ide_chat string `json:"ide_chat,omitempty"` // The organization policy for allowing or disallowing Copilot Chat in the IDE. - Plan_type string `json:"plan_type,omitempty"` // The Copilot plan of the organization, or the parent enterprise, when applicable. +// GeneratedType_Webhook_repository_ruleset_created represents the GeneratedType_Webhook_repository_ruleset_created schema from the OpenAPI specification +type GeneratedType_Webhook_repository_ruleset_created struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Repository_ruleset GeneratedType_Repository_ruleset `json:"repository_ruleset"` // A set of rules to apply when specified conditions are met. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Contexts []string `json:"contexts"` - Contexts_url string `json:"contexts_url"` - Strict bool `json:"strict"` - Url string `json:"url"` - Checks []map[string]interface{} `json:"checks"` +// GeneratedType_Webhook_pull_request_review_comment_created represents the GeneratedType_Webhook_pull_request_review_comment_created schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_comment_created struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Comment map[string]interface{} `json:"comment"` // The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Message string `json:"message"` - Sha string `json:"sha"` - Merged bool `json:"merged"` +// GeneratedType_Repository_advisory_credit represents the GeneratedType_Repository_advisory_credit schema from the OpenAPI specification +type GeneratedType_Repository_advisory_credit struct { + State string `json:"state"` // The state of the user's acceptance of the credit. + TypeField string `json:"type"` // The type of credit the user is receiving. + User GeneratedType_Simple_user `json:"user"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Usageitems []map[string]interface{} `json:"usageItems,omitempty"` +// GeneratedType_Webhook_discussion_answered represents the GeneratedType_Webhook_discussion_answered schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_answered struct { + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Answer Webhooksanswer `json:"answer"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Draft bool `json:"draft,omitempty"` - Labels []map[string]interface{} `json:"labels"` - Body_html string `json:"body_html,omitempty"` - Body_text string `json:"body_text,omitempty"` - Active_lock_reason string `json:"active_lock_reason,omitempty"` - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Html_url string `json:"html_url"` - Reactions GeneratedType `json:"reactions,omitempty"` - Milestone GeneratedType `json:"milestone"` // A collection of related issues and pull requests. - Repository Repository `json:"repository,omitempty"` // A repository on GitHub. - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` - Id int64 `json:"id"` - Updated_at string `json:"updated_at"` - Score float64 `json:"score"` - TypeField GeneratedType `json:"type,omitempty"` // The type of issue. - State string `json:"state"` - Assignees []GeneratedType `json:"assignees,omitempty"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Comments int `json:"comments"` - Timeline_url string `json:"timeline_url,omitempty"` - Locked bool `json:"locked"` - Comments_url string `json:"comments_url"` - Created_at string `json:"created_at"` - Sub_issues_summary map[string]interface{} `json:"sub_issues_summary,omitempty"` - Title string `json:"title"` - State_reason string `json:"state_reason,omitempty"` - Labels_url string `json:"labels_url"` - Number int `json:"number"` - Body string `json:"body,omitempty"` - Closed_at string `json:"closed_at"` - Events_url string `json:"events_url"` - Node_id string `json:"node_id"` - Repository_url string `json:"repository_url"` - Url string `json:"url"` - Pull_request map[string]interface{} `json:"pull_request,omitempty"` - User GeneratedType `json:"user"` // A GitHub user. - Author_association string `json:"author_association"` // How the author is associated with the repository. +// GeneratedType_Webhook_public represents the GeneratedType_Webhook_public schema from the OpenAPI specification +type GeneratedType_Webhook_public struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Cve_id string `json:"cve_id,omitempty"` // The Common Vulnerabilities and Exposures (CVE) ID. - Summary string `json:"summary"` // A short summary of the advisory. - Description string `json:"description"` // A detailed description of what the advisory impacts. - Start_private_fork bool `json:"start_private_fork,omitempty"` // Whether to create a temporary private fork of the repository to collaborate on a fix. - Vulnerabilities []map[string]interface{} `json:"vulnerabilities"` // A product affected by the vulnerability detailed in a repository security advisory. - Cvss_vector_string string `json:"cvss_vector_string,omitempty"` // The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`. - Cwe_ids []string `json:"cwe_ids,omitempty"` // A list of Common Weakness Enumeration (CWE) IDs. - Severity string `json:"severity,omitempty"` // The severity of the advisory. You must choose between setting this field or `cvss_vector_string`. - Credits []map[string]interface{} `json:"credits,omitempty"` // A list of users receiving credit for their participation in the security advisory. +// GeneratedType_Webhook_milestone_closed represents the GeneratedType_Webhook_milestone_closed schema from the OpenAPI specification +type GeneratedType_Webhook_milestone_closed struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization_url string `json:"organization_url"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Role string `json:"role"` // The user's membership type in the organization. - State string `json:"state"` // The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation. - Url string `json:"url"` - User GeneratedType `json:"user"` // A GitHub user. - Organization GeneratedType `json:"organization"` // A GitHub organization. +// GeneratedType_Dependabot_alert represents the GeneratedType_Dependabot_alert schema from the OpenAPI specification +type GeneratedType_Dependabot_alert struct { + Dismissed_by GeneratedType_Nullable_simple_user `json:"dismissed_by"` // A GitHub user. + Fixed_at string `json:"fixed_at"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_comment string `json:"dismissed_comment"` // An optional comment associated with the alert's dismissal. + Updated_at string `json:"updated_at"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_reason string `json:"dismissed_reason"` // The reason that the alert was dismissed. + Url string `json:"url"` // The REST API URL of the alert resource. + Auto_dismissed_at string `json:"auto_dismissed_at,omitempty"` // The time that the alert was auto-dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dependency map[string]interface{} `json:"dependency"` // Details for the vulnerable dependency. + Security_advisory GeneratedType_Dependabot_alert_security_advisory `json:"security_advisory"` // Details for the GitHub Security Advisory. + Html_url string `json:"html_url"` // The GitHub URL of the alert resource. + State string `json:"state"` // The state of the Dependabot alert. + Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Security_vulnerability GeneratedType_Dependabot_alert_security_vulnerability `json:"security_vulnerability"` // Details pertaining to one vulnerable version range for the advisory. + Number int `json:"number"` // The security alert number. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Porter_author represents the GeneratedType_Porter_author schema from the OpenAPI specification +type GeneratedType_Porter_author struct { + Name string `json:"name"` + Remote_id string `json:"remote_id"` + Remote_name string `json:"remote_name"` + Url string `json:"url"` + Email string `json:"email"` + Id int `json:"id"` + Import_url string `json:"import_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Results_count int `json:"results_count"` // The total number of results in the analysis. - Category string `json:"category,omitempty"` // Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code. - Url string `json:"url"` // The REST API URL of the analysis resource. - Environment string `json:"environment"` // Identifies the variable values associated with the environment in which this analysis was performed. - Ref string `json:"ref"` // The Git reference, formatted as `refs/pull//merge`, `refs/pull//head`, `refs/heads/` or simply ``. - Id int `json:"id"` // Unique identifier for this analysis. - Rules_count int `json:"rules_count"` // The total number of rules used in the analysis. - Created_at string `json:"created_at"` // The time that the analysis was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Deletable bool `json:"deletable"` - Warning string `json:"warning"` // Warning generated when processing the analysis - Commit_sha string `json:"commit_sha"` // The SHA of the commit to which the analysis you are uploading relates. - Sarif_id string `json:"sarif_id"` // An identifier for the upload. - Tool GeneratedType `json:"tool"` - Analysis_key string `json:"analysis_key"` // Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. - ErrorField string `json:"error"` +// GeneratedType_Repository_subscription represents the GeneratedType_Repository_subscription schema from the OpenAPI specification +type GeneratedType_Repository_subscription struct { + Url string `json:"url"` + Created_at string `json:"created_at"` + Ignored bool `json:"ignored"` // Determines if all notifications should be blocked from this repository. + Reason string `json:"reason"` + Repository_url string `json:"repository_url"` + Subscribed bool `json:"subscribed"` // Determines if notifications should be received from this repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organizations_url string `json:"organizations_url"` - Gists_url string `json:"gists_url"` - Login string `json:"login"` - Public_gists int `json:"public_gists,omitempty"` - Following_url string `json:"following_url"` - Hireable bool `json:"hireable,omitempty"` - Bio string `json:"bio,omitempty"` - Score float64 `json:"score"` - Received_events_url string `json:"received_events_url"` - Name string `json:"name,omitempty"` +// Webhooksusermannequin represents the Webhooksusermannequin schema from the OpenAPI specification +type Webhooksusermannequin struct { + Organizations_url string `json:"organizations_url,omitempty"` + Received_events_url string `json:"received_events_url,omitempty"` + Starred_url string `json:"starred_url,omitempty"` + Avatar_url string `json:"avatar_url,omitempty"` + Deleted bool `json:"deleted,omitempty"` + Node_id string `json:"node_id,omitempty"` + Html_url string `json:"html_url,omitempty"` + Following_url string `json:"following_url,omitempty"` + Events_url string `json:"events_url,omitempty"` + Followers_url string `json:"followers_url,omitempty"` + Subscriptions_url string `json:"subscriptions_url,omitempty"` Email string `json:"email,omitempty"` - Events_url string `json:"events_url"` - Followers int `json:"followers,omitempty"` - Node_id string `json:"node_id"` - Starred_url string `json:"starred_url"` - Subscriptions_url string `json:"subscriptions_url"` - Suspended_at string `json:"suspended_at,omitempty"` - Id int64 `json:"id"` - Public_repos int `json:"public_repos,omitempty"` - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` - Url string `json:"url"` - Location string `json:"location,omitempty"` + Repos_url string `json:"repos_url,omitempty"` + Gravatar_id string `json:"gravatar_id,omitempty"` + Name string `json:"name,omitempty"` + Gists_url string `json:"gists_url,omitempty"` + Site_admin bool `json:"site_admin,omitempty"` + Url string `json:"url,omitempty"` + Login string `json:"login"` + Id int `json:"id"` User_view_type string `json:"user_view_type,omitempty"` - Following int `json:"following,omitempty"` - Blog string `json:"blog,omitempty"` - Avatar_url string `json:"avatar_url"` - Followers_url string `json:"followers_url"` - Created_at string `json:"created_at,omitempty"` - Html_url string `json:"html_url"` - Repos_url string `json:"repos_url"` - Site_admin bool `json:"site_admin"` - Updated_at string `json:"updated_at,omitempty"` - Gravatar_id string `json:"gravatar_id"` - Company string `json:"company,omitempty"` - TypeField string `json:"type"` + TypeField string `json:"type,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Credits []map[string]interface{} `json:"credits"` - Cvss_severities GeneratedType `json:"cvss_severities,omitempty"` - Ghsa_id string `json:"ghsa_id"` // The GitHub Security Advisory ID. - Summary string `json:"summary"` // A short summary of the advisory. - Author interface{} `json:"author"` // The author of the advisory. - Cve_id string `json:"cve_id"` // The Common Vulnerabilities and Exposures (CVE) ID. - Cvss map[string]interface{} `json:"cvss"` - Submission map[string]interface{} `json:"submission"` - Collaborating_users []GeneratedType `json:"collaborating_users"` // A list of users that collaborate on the advisory. - Created_at string `json:"created_at"` // The date and time of when the advisory was created, in ISO 8601 format. - Description string `json:"description"` // A detailed description of what the advisory entails. - Url string `json:"url"` // The API URL for the advisory. - Vulnerabilities []GeneratedType `json:"vulnerabilities"` - Collaborating_teams []Team `json:"collaborating_teams"` // A list of teams that collaborate on the advisory. - Credits_detailed []GeneratedType `json:"credits_detailed"` - Cwes []map[string]interface{} `json:"cwes"` - State string `json:"state"` // The state of the advisory. - Html_url string `json:"html_url"` // The URL for the advisory. - Updated_at string `json:"updated_at"` // The date and time of when the advisory was last updated, in ISO 8601 format. - Private_fork interface{} `json:"private_fork"` // A temporary private fork of the advisory's repository for collaborating on a fix. - Cwe_ids []string `json:"cwe_ids"` // A list of only the CWE IDs. - Publisher interface{} `json:"publisher"` // The publisher of the advisory. - Closed_at string `json:"closed_at"` // The date and time of when the advisory was closed, in ISO 8601 format. - Severity string `json:"severity"` // The severity of the advisory. - Identifiers []map[string]interface{} `json:"identifiers"` - Published_at string `json:"published_at"` // The date and time of when the advisory was published, in ISO 8601 format. - Withdrawn_at string `json:"withdrawn_at"` // The date and time of when the advisory was withdrawn, in ISO 8601 format. +// GeneratedType_Custom_property_value represents the GeneratedType_Custom_property_value schema from the OpenAPI specification +type GeneratedType_Custom_property_value struct { + Value string `json:"value"` // The value assigned to the property + Property_name string `json:"property_name"` // The name of the property } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Hook map[string]interface{} `json:"hook"` // The deleted webhook. This will contain different keys based on the type of webhook it is: repository, organization, business, app, or GitHub Marketplace. - Hook_id int `json:"hook_id"` // The id of the modified webhook. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_project_column_deleted represents the GeneratedType_Webhook_project_column_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_project_column_deleted struct { + Repository GeneratedType_Nullable_repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_column Webhooksprojectcolumn `json:"project_column"` +} + +// GeneratedType_Organization_dependabot_secret represents the GeneratedType_Organization_dependabot_secret schema from the OpenAPI specification +type GeneratedType_Organization_dependabot_secret struct { + Visibility string `json:"visibility"` // Visibility of a secret + Created_at string `json:"created_at"` + Name string `json:"name"` // The name of the secret. + Selected_repositories_url string `json:"selected_repositories_url,omitempty"` + Updated_at string `json:"updated_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Repository_ruleset GeneratedType `json:"repository_ruleset"` // A set of rules to apply when specified conditions are met. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_branch_protection_rule_created represents the GeneratedType_Webhook_branch_protection_rule_created schema from the OpenAPI specification +type GeneratedType_Webhook_branch_protection_rule_created struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Rule Webhooksrule `json:"rule"` // The branch protection rule. Includes a `name` and all the [branch protection settings](https://docs.github.com/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-settings) applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of `off`, `non_admins`, or `everyone`. Actor and build lists are arrays of strings. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Import_url string `json:"import_url"` - Name string `json:"name"` - Remote_id string `json:"remote_id"` - Remote_name string `json:"remote_name"` +// Environment represents the Environment schema from the OpenAPI specification +type Environment struct { + Name string `json:"name"` // The name of the environment. + Protection_rules []interface{} `json:"protection_rules,omitempty"` // Built-in deployment protection rules for the environment. Url string `json:"url"` - Email string `json:"email"` - Id int `json:"id"` + Html_url string `json:"html_url"` + Id int64 `json:"id"` // The id of the environment. + Updated_at string `json:"updated_at"` // The time that the environment was last updated, in ISO 8601 format. + Created_at string `json:"created_at"` // The time that the environment was created, in ISO 8601 format. + Deployment_branch_policy GeneratedType_Deployment_branch_policy_settings `json:"deployment_branch_policy,omitempty"` // The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`. + Node_id string `json:"node_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Ruleset_id int `json:"ruleset_id,omitempty"` // The ID of the ruleset that includes this rule. - Ruleset_source string `json:"ruleset_source,omitempty"` // The name of the source of the ruleset that includes this rule. - Ruleset_source_type string `json:"ruleset_source_type,omitempty"` // The type of source for the ruleset that includes this rule. +// GeneratedType_Repository_invitation represents the GeneratedType_Repository_invitation schema from the OpenAPI specification +type GeneratedType_Repository_invitation struct { + Id int64 `json:"id"` // Unique identifier of the repository invitation. + Invitee GeneratedType_Nullable_simple_user `json:"invitee"` // A GitHub user. + Node_id string `json:"node_id"` + Permissions string `json:"permissions"` // The permission associated with the invitation. + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + Html_url string `json:"html_url"` + Url string `json:"url"` // URL for the repository invitation + Created_at string `json:"created_at"` + Inviter GeneratedType_Nullable_simple_user `json:"inviter"` // A GitHub user. + Expired bool `json:"expired,omitempty"` // Whether or not the invitation has expired } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_run map[string]interface{} `json:"workflow_run"` - Environment string `json:"environment"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Since string `json:"since"` +// GeneratedType_Webhook_sub_issues_sub_issue_added represents the GeneratedType_Webhook_sub_issues_sub_issue_added schema from the OpenAPI specification +type GeneratedType_Webhook_sub_issues_sub_issue_added struct { + Sub_issue_repo Repository `json:"sub_issue_repo"` // A repository on GitHub. Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Reviewers []map[string]interface{} `json:"reviewers"` - Workflow_job_run map[string]interface{} `json:"workflow_job_run"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Requestor Webhooksuser `json:"requestor"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Most_recent_instance GeneratedType `json:"most_recent_instance"` - Number int `json:"number"` // The security alert number. - Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - State string `json:"state"` // State of a code scanning alert. - Dismissed_comment string `json:"dismissed_comment,omitempty"` // The dismissal comment associated with the dismissal of the alert. - Url string `json:"url"` // The REST API URL of the alert resource. - Html_url string `json:"html_url"` // The GitHub URL of the alert resource. - Rule GeneratedType `json:"rule"` - Dismissed_by GeneratedType `json:"dismissed_by"` // A GitHub user. - Fixed_at string `json:"fixed_at,omitempty"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Tool GeneratedType `json:"tool"` - Repository GeneratedType `json:"repository"` // A GitHub repository. - Dismissal_approved_by GeneratedType `json:"dismissal_approved_by,omitempty"` // A GitHub user. - Dismissed_reason string `json:"dismissed_reason"` // **Required when the state is dismissed.** The reason for dismissing or closing the alert. - Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Instances_url string `json:"instances_url"` // The REST API URL for fetching the list of instances for an alert. +// GeneratedType_Timeline_commit_commented_event represents the GeneratedType_Timeline_commit_commented_event schema from the OpenAPI specification +type GeneratedType_Timeline_commit_commented_event struct { + Comments []GeneratedType_Commit_comment `json:"comments,omitempty"` + Commit_id string `json:"commit_id,omitempty"` + Event string `json:"event,omitempty"` + Node_id string `json:"node_id,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Requested_reviewers []GeneratedType `json:"requested_reviewers,omitempty"` - User GeneratedType `json:"user"` // A GitHub user. - Links map[string]interface{} `json:"_links"` - Merged bool `json:"merged"` - Diff_url string `json:"diff_url"` - Mergeable bool `json:"mergeable"` - Mergeable_state string `json:"mergeable_state"` - Assignees []GeneratedType `json:"assignees,omitempty"` - Changed_files int `json:"changed_files"` - Base map[string]interface{} `json:"base"` - Review_comments int `json:"review_comments"` - Title string `json:"title"` // The title of the pull request. - Merge_commit_sha string `json:"merge_commit_sha"` - Auto_merge GeneratedType `json:"auto_merge"` // The status of auto merging a pull request. - Review_comments_url string `json:"review_comments_url"` - Comments_url string `json:"comments_url"` - Milestone GeneratedType `json:"milestone"` // A collection of related issues and pull requests. +// GeneratedType_Integration_installation_request represents the GeneratedType_Integration_installation_request schema from the OpenAPI specification +type GeneratedType_Integration_installation_request struct { + Account interface{} `json:"account"` + Created_at string `json:"created_at"` + Id int `json:"id"` // Unique identifier of the request installation. + Node_id string `json:"node_id,omitempty"` + Requester GeneratedType_Simple_user `json:"requester"` // A GitHub user. +} + +// GeneratedType_Commit_search_result_item represents the GeneratedType_Commit_search_result_item schema from the OpenAPI specification +type GeneratedType_Commit_search_result_item struct { + Author GeneratedType_Nullable_simple_user `json:"author"` // A GitHub user. + Committer GeneratedType_Nullable_git_user `json:"committer"` // Metaproperties for Git author/committer information. Html_url string `json:"html_url"` - Draft bool `json:"draft,omitempty"` // Indicates whether or not the pull request is a draft. - Head map[string]interface{} `json:"head"` - Id int64 `json:"id"` - Merged_at string `json:"merged_at"` - Review_comment_url string `json:"review_comment_url"` - Updated_at string `json:"updated_at"` + Score float64 `json:"score"` + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` + Commit map[string]interface{} `json:"commit"` + Parents []map[string]interface{} `json:"parents"` Url string `json:"url"` - Additions int `json:"additions"` - Locked bool `json:"locked"` - Labels []map[string]interface{} `json:"labels"` + Comments_url string `json:"comments_url"` + Sha string `json:"sha"` Node_id string `json:"node_id"` - Commits int `json:"commits"` - Patch_url string `json:"patch_url"` - Requested_teams []GeneratedType `json:"requested_teams,omitempty"` - Comments int `json:"comments"` - Deletions int `json:"deletions"` - Number int `json:"number"` // Number uniquely identifying the pull request within its repository. - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Closed_at string `json:"closed_at"` - Created_at string `json:"created_at"` - Active_lock_reason string `json:"active_lock_reason,omitempty"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Maintainer_can_modify bool `json:"maintainer_can_modify"` // Indicates whether maintainers can modify the pull request. - State string `json:"state"` // State of this Pull Request. Either `open` or `closed`. - Statuses_url string `json:"statuses_url"` - Body string `json:"body"` - Merged_by GeneratedType `json:"merged_by"` // A GitHub user. - Commits_url string `json:"commits_url"` - Rebaseable bool `json:"rebaseable,omitempty"` - Issue_url string `json:"issue_url"` - Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). - Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead.** - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow auto-merge for pull requests. - Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether to allow updating the pull request's branch. - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged. - Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. - Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., "Merge pull request #123 from branch-name"). - Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_security_advisory_published represents the GeneratedType_Webhook_security_advisory_published schema from the OpenAPI specification +type GeneratedType_Webhook_security_advisory_published struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Security_advisory Webhookssecurityadvisory `json:"security_advisory"` // The details of the security advisory, including summary, description, and severity. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Fixed_at string `json:"fixed_at,omitempty"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Url string `json:"url"` // The REST API URL of the alert resource. - Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Number int `json:"number"` // The security alert number. - Dismissal_approved_by GeneratedType `json:"dismissal_approved_by,omitempty"` // A GitHub user. - Rule GeneratedType `json:"rule"` - Dismissed_comment string `json:"dismissed_comment,omitempty"` // The dismissal comment associated with the dismissal of the alert. - State string `json:"state"` // State of a code scanning alert. - Dismissed_by GeneratedType `json:"dismissed_by"` // A GitHub user. - Dismissed_reason string `json:"dismissed_reason"` // **Required when the state is dismissed.** The reason for dismissing or closing the alert. - Instances_url string `json:"instances_url"` // The REST API URL for fetching the list of instances for an alert. - Most_recent_instance GeneratedType `json:"most_recent_instance"` - Tool GeneratedType `json:"tool"` - Html_url string `json:"html_url"` // The GitHub URL of the alert resource. - Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// Stargazer represents the Stargazer schema from the OpenAPI specification -type Stargazer struct { - Starred_at string `json:"starred_at"` - User GeneratedType `json:"user"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_release_created represents the GeneratedType_Webhook_release_created schema from the OpenAPI specification +type GeneratedType_Webhook_release_created struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Sender GeneratedType `json:"sender"` // A GitHub user. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Reason string `json:"reason"` - Number int `json:"number"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Advanced_security map[string]interface{} `json:"advanced_security,omitempty"` - Code_security map[string]interface{} `json:"code_security,omitempty"` - Dependabot_security_updates map[string]interface{} `json:"dependabot_security_updates,omitempty"` // Enable or disable Dependabot security updates for the repository. - Secret_scanning map[string]interface{} `json:"secret_scanning,omitempty"` - Secret_scanning_ai_detection map[string]interface{} `json:"secret_scanning_ai_detection,omitempty"` - Secret_scanning_non_provider_patterns map[string]interface{} `json:"secret_scanning_non_provider_patterns,omitempty"` - Secret_scanning_push_protection map[string]interface{} `json:"secret_scanning_push_protection,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Completed_at string `json:"completed_at,omitempty"` // Completion time of the last export operation - Export_url string `json:"export_url,omitempty"` // Url for fetching export details - Html_url string `json:"html_url,omitempty"` // Web url for the exported branch - Id string `json:"id,omitempty"` // Id for the export details - Sha string `json:"sha,omitempty"` // Git commit SHA of the exported branch - State string `json:"state,omitempty"` // State of the latest export - Branch string `json:"branch,omitempty"` // Name of the exported branch +// GeneratedType_Dependabot_alert_security_vulnerability represents the GeneratedType_Dependabot_alert_security_vulnerability schema from the OpenAPI specification +type GeneratedType_Dependabot_alert_security_vulnerability struct { + Vulnerable_version_range string `json:"vulnerable_version_range"` // Conditions that identify vulnerable versions of this vulnerability's package. + First_patched_version map[string]interface{} `json:"first_patched_version"` // Details pertaining to the package version that patches this vulnerability. + PackageField GeneratedType_Dependabot_alert_package `json:"package"` // Details for the vulnerable package. + Severity string `json:"severity"` // The severity of the vulnerability. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` // Unique identifier of the package version. - Url string `json:"url"` - Deleted_at string `json:"deleted_at,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name"` // The name of the package version. - Updated_at string `json:"updated_at"` - Metadata map[string]interface{} `json:"metadata,omitempty"` - Html_url string `json:"html_url,omitempty"` - License string `json:"license,omitempty"` - Package_html_url string `json:"package_html_url"` - Created_at string `json:"created_at"` +// GeneratedType_Webhook_star_created represents the GeneratedType_Webhook_star_created schema from the OpenAPI specification +type GeneratedType_Webhook_star_created struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Starred_at string `json:"starred_at"` // The time the star was created. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Will be `null` for the `deleted` action. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue_comment_url string `json:"issue_comment_url"` // The API URL to get the issue comment where the secret was detected. +// GeneratedType_Webhook_package_updated represents the GeneratedType_Webhook_package_updated schema from the OpenAPI specification +type GeneratedType_Webhook_package_updated struct { + PackageField map[string]interface{} `json:"package"` // Information about the package. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// Webhookschanges represents the Webhookschanges schema from the OpenAPI specification -type Webhookschanges struct { - Body map[string]interface{} `json:"body,omitempty"` +// GeneratedType_Webhook_personal_access_token_request_created represents the GeneratedType_Webhook_personal_access_token_request_created schema from the OpenAPI specification +type GeneratedType_Webhook_personal_access_token_request_created struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Personal_access_token_request GeneratedType_Personal_access_token_request `json:"personal_access_token_request"` // Details of a Personal Access Token Request. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_id int `json:"repository_id"` // The id of the repository associated with this event. - Status string `json:"status"` // Description of the status of the attempted delivery - Status_code int `json:"status_code"` // Status code received when delivery was made. - Url string `json:"url,omitempty"` // The URL target of the delivery. - Delivered_at string `json:"delivered_at"` // Time when the delivery was delivered. - Duration float64 `json:"duration"` // Time spent delivering. - Id int `json:"id"` // Unique identifier of the delivery. - Guid string `json:"guid"` // Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event). - Action string `json:"action"` // The type of activity for the event that triggered the delivery. - Throttled_at string `json:"throttled_at,omitempty"` // Time when the webhook delivery was throttled. - Installation_id int `json:"installation_id"` // The id of the GitHub App installation associated with this event. - Response map[string]interface{} `json:"response"` - Redelivery bool `json:"redelivery"` // Whether the delivery is a redelivery. - Event string `json:"event"` // The event that triggered the delivery. - Request map[string]interface{} `json:"request"` +// GeneratedType_Pull_request_merge_result represents the GeneratedType_Pull_request_merge_result schema from the OpenAPI specification +type GeneratedType_Pull_request_merge_result struct { + Merged bool `json:"merged"` + Message string `json:"message"` + Sha string `json:"sha"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url"` - Body string `json:"body"` // The main text of the comment. - Created_at string `json:"created_at"` - Last_edited_at string `json:"last_edited_at"` - Node_id string `json:"node_id"` - Reactions GeneratedType `json:"reactions,omitempty"` - Updated_at string `json:"updated_at"` - Body_html string `json:"body_html"` - Discussion_url string `json:"discussion_url"` +// Installation represents the Installation schema from the OpenAPI specification +type Installation struct { + Target_type string `json:"target_type"` + Account interface{} `json:"account"` + Has_multiple_single_files bool `json:"has_multiple_single_files,omitempty"` + Target_id int `json:"target_id"` // The ID of the user or organization this token is being scoped to. + Access_tokens_url string `json:"access_tokens_url"` + Single_file_paths []string `json:"single_file_paths,omitempty"` + Id int `json:"id"` // The ID of the installation. + Single_file_name string `json:"single_file_name"` + Suspended_at string `json:"suspended_at"` Html_url string `json:"html_url"` - Number int `json:"number"` // The unique sequence number of a team discussion comment. - Author GeneratedType `json:"author"` // A GitHub user. - Body_version string `json:"body_version"` // The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Comment Webhookscomment `json:"comment"` + Suspended_by GeneratedType_Nullable_simple_user `json:"suspended_by"` // A GitHub user. + Updated_at string `json:"updated_at"` + App_slug string `json:"app_slug"` + Contact_email string `json:"contact_email,omitempty"` + Repositories_url string `json:"repositories_url"` + Created_at string `json:"created_at"` + App_id int `json:"app_id"` + Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved + Permissions GeneratedType_App_permissions `json:"permissions"` // The permissions granted to the user access token. + Events []string `json:"events"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Reason string `json:"reason"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_discussion_unpinned represents the GeneratedType_Webhook_discussion_unpinned schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_unpinned struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender"` // A GitHub user. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Pull_request map[string]interface{} `json:"pull_request"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Incremental_scans []GeneratedType `json:"incremental_scans,omitempty"` - Pattern_update_scans []GeneratedType `json:"pattern_update_scans,omitempty"` - Backfill_scans []GeneratedType `json:"backfill_scans,omitempty"` - Custom_pattern_backfill_scans []interface{} `json:"custom_pattern_backfill_scans,omitempty"` +// Autolink represents the Autolink schema from the OpenAPI specification +type Autolink struct { + Id int `json:"id"` + Is_alphanumeric bool `json:"is_alphanumeric"` // Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. + Key_prefix string `json:"key_prefix"` // The prefix of a key that is linkified. + Url_template string `json:"url_template"` // A template for the target URL that is generated if a key was found. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - PackageField map[string]interface{} `json:"package"` // The name of the package affected by the vulnerability. - Patched_versions string `json:"patched_versions"` // The package version(s) that resolve the vulnerability. - Vulnerable_functions []string `json:"vulnerable_functions"` // The functions in the package that are affected. - Vulnerable_version_range string `json:"vulnerable_version_range"` // The range of the package versions affected by the vulnerability. +// GeneratedType_Workflow_usage represents the GeneratedType_Workflow_usage schema from the OpenAPI specification +type GeneratedType_Workflow_usage struct { + Billable map[string]interface{} `json:"billable"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the private registry configuration. - Registry_type string `json:"registry_type"` // The registry type. - Updated_at string `json:"updated_at"` - Username string `json:"username,omitempty"` // The username to use when authenticating with the private registry. - Visibility string `json:"visibility"` // Which type of organization repositories have access to the private registry. - Created_at string `json:"created_at"` +// GeneratedType_Branch_protection represents the GeneratedType_Branch_protection schema from the OpenAPI specification +type GeneratedType_Branch_protection struct { + Url string `json:"url,omitempty"` + Allow_deletions map[string]interface{} `json:"allow_deletions,omitempty"` + Required_linear_history map[string]interface{} `json:"required_linear_history,omitempty"` + Enforce_admins GeneratedType_Protected_branch_admin_enforced `json:"enforce_admins,omitempty"` // Protected Branch Admin Enforced + Restrictions GeneratedType_Branch_restriction_policy `json:"restrictions,omitempty"` // Branch Restriction Policy + Required_signatures map[string]interface{} `json:"required_signatures,omitempty"` + Allow_fork_syncing map[string]interface{} `json:"allow_fork_syncing,omitempty"` // Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow fork syncing. Set to `false` to prevent fork syncing. + Block_creations map[string]interface{} `json:"block_creations,omitempty"` + Enabled bool `json:"enabled,omitempty"` + Name string `json:"name,omitempty"` + Required_conversation_resolution map[string]interface{} `json:"required_conversation_resolution,omitempty"` + Required_pull_request_reviews GeneratedType_Protected_branch_pull_request_review `json:"required_pull_request_reviews,omitempty"` // Protected Branch Pull Request Review + Required_status_checks GeneratedType_Protected_branch_required_status_check `json:"required_status_checks,omitempty"` // Protected Branch Required Status Check + Lock_branch map[string]interface{} `json:"lock_branch,omitempty"` // Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. + Allow_force_pushes map[string]interface{} `json:"allow_force_pushes,omitempty"` + Protection_url string `json:"protection_url,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Action string `json:"action"` - Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. - Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Dependabot_alert_security_advisory represents the GeneratedType_Dependabot_alert_security_advisory schema from the OpenAPI specification +type GeneratedType_Dependabot_alert_security_advisory struct { + Cvss map[string]interface{} `json:"cvss"` // Details for the advisory pertaining to the Common Vulnerability Scoring System. + Updated_at string `json:"updated_at"` // The time that the advisory was last modified in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Epss GeneratedType_Security_advisory_epss `json:"epss,omitempty"` // The EPSS scores as calculated by the [Exploit Prediction Scoring System](https://www.first.org/epss). + References []map[string]interface{} `json:"references"` // Links to additional advisory information. + Vulnerabilities []GeneratedType_Dependabot_alert_security_vulnerability `json:"vulnerabilities"` // Vulnerable version range information for the advisory. + Cve_id string `json:"cve_id"` // The unique CVE ID assigned to the advisory. + Identifiers []map[string]interface{} `json:"identifiers"` // Values that identify this advisory among security information sources. + Cvss_severities GeneratedType_Cvss_severities `json:"cvss_severities,omitempty"` + Cwes []map[string]interface{} `json:"cwes"` // Details for the advisory pertaining to Common Weakness Enumeration. + Description string `json:"description"` // A long-form Markdown-supported description of the advisory. + Ghsa_id string `json:"ghsa_id"` // The unique GitHub Security Advisory ID assigned to the advisory. + Published_at string `json:"published_at"` // The time that the advisory was published in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Severity string `json:"severity"` // The severity of the advisory. + Summary string `json:"summary"` // A short, plain text summary of the advisory. + Withdrawn_at string `json:"withdrawn_at"` // The time that the advisory was withdrawn in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. } -// Webhooksmembership represents the Webhooksmembership schema from the OpenAPI specification -type Webhooksmembership struct { - Url string `json:"url"` - User map[string]interface{} `json:"user"` - Organization_url string `json:"organization_url"` - Role string `json:"role"` - State string `json:"state"` +// GeneratedType_Interaction_limit_response represents the GeneratedType_Interaction_limit_response schema from the OpenAPI specification +type GeneratedType_Interaction_limit_response struct { + Limit string `json:"limit"` // The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. + Origin string `json:"origin"` + Expires_at string `json:"expires_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Total_active_caches_count int `json:"total_active_caches_count"` // The count of active caches across all repositories of an enterprise or an organization. - Total_active_caches_size_in_bytes int `json:"total_active_caches_size_in_bytes"` // The total size in bytes of all active cache items across all repositories of an enterprise or an organization. +// GeneratedType_Webhook_pull_request_opened represents the GeneratedType_Webhook_pull_request_opened schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_opened struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request GeneratedType_Pull_request_webhook `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` // The pull request number. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Body string `json:"body"` // The generated body describing the contents of the release supporting markdown formatting - Name string `json:"name"` // The generated name of the release +// GeneratedType_Repository_rule_params_workflow_file_reference represents the GeneratedType_Repository_rule_params_workflow_file_reference schema from the OpenAPI specification +type GeneratedType_Repository_rule_params_workflow_file_reference struct { + Ref string `json:"ref,omitempty"` // The ref (branch or tag) of the workflow file to use + Repository_id int `json:"repository_id"` // The ID of the repository where the workflow is defined + Sha string `json:"sha,omitempty"` // The commit SHA of the workflow file to use + Path string `json:"path"` // The path to the workflow file } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_organization_member_removed represents the GeneratedType_Webhook_organization_member_removed schema from the OpenAPI specification +type GeneratedType_Webhook_organization_member_removed struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Alert Webhooksalert `json:"alert"` // The security alert of the vulnerable dependency. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Membership Webhooksmembership `json:"membership"` // The membership between the user and the organization. Not present when the action is `member_invited`. + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_discussion_comment_edited represents the GeneratedType_Webhook_discussion_comment_edited schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_comment_edited struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Changes map[string]interface{} `json:"changes"` + Comment Webhookscomment `json:"comment"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` // The changes to the collaborator permissions - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Member Webhooksuser `json:"member"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Status string `json:"status"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Ref string `json:"ref"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow string `json:"workflow"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Inputs map[string]interface{} `json:"inputs"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Webhook_dependabot_alert_auto_reopened represents the GeneratedType_Webhook_dependabot_alert_auto_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_auto_reopened struct { + Action string `json:"action"` + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id,omitempty"` - Organization_billing_email string `json:"organization_billing_email,omitempty"` - TypeField string `json:"type"` - Url string `json:"url"` - Email string `json:"email,omitempty"` +// GeneratedType_Milestoned_issue_event represents the GeneratedType_Milestoned_issue_event schema from the OpenAPI specification +type GeneratedType_Milestoned_issue_event struct { + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Event string `json:"event"` + Node_id string `json:"node_id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Commit_id string `json:"commit_id"` Id int `json:"id"` - Login string `json:"login"` + Milestone map[string]interface{} `json:"milestone"` + Url string `json:"url"` + Commit_url string `json:"commit_url"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Nullable_integration represents the GeneratedType_Nullable_integration schema from the OpenAPI specification +type GeneratedType_Nullable_integration struct { + Permissions map[string]interface{} `json:"permissions"` // The set of permissions for the GitHub app + Description string `json:"description"` + Events []string `json:"events"` // The list of events for the GitHub app. Note that the `installation_target`, `security_advisory`, and `meta` events are not included because they are global events and not specific to an installation. + Installations_count int `json:"installations_count,omitempty"` // The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself. + Owner interface{} `json:"owner"` + External_url string `json:"external_url"` Updated_at string `json:"updated_at"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Avatar_url string `json:"avatar_url,omitempty"` - Target_url string `json:"target_url"` // The optional link added to the status. - Branches []map[string]interface{} `json:"branches"` // An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches. - Id int `json:"id"` // The unique identifier of the status. Created_at string `json:"created_at"` - Sha string `json:"sha"` // The Commit SHA. - Context string `json:"context"` - Description string `json:"description"` // The optional human-readable description added to the status. - Name string `json:"name"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - State string `json:"state"` // The new state. Can be `pending`, `success`, `failure`, or `error`. - Commit map[string]interface{} `json:"commit"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Status string `json:"status"` // Describes the response returned after attempting the delivery. - Throttled_at string `json:"throttled_at,omitempty"` // Time when the webhook delivery was throttled. - Event string `json:"event"` // The event that triggered the delivery. - Redelivery bool `json:"redelivery"` // Whether the webhook delivery is a redelivery. - Status_code int `json:"status_code"` // Status code received when delivery was made. - Repository_id int64 `json:"repository_id"` // The id of the repository associated with this event. - Delivered_at string `json:"delivered_at"` // Time when the webhook delivery occurred. - Duration float64 `json:"duration"` // Time spent delivering. - Guid string `json:"guid"` // Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event). - Action string `json:"action"` // The type of activity for the event that triggered the delivery. - Id int64 `json:"id"` // Unique identifier of the webhook delivery. - Installation_id int64 `json:"installation_id"` // The id of the GitHub App installation associated with this event. + Id int `json:"id"` // Unique identifier of the GitHub app + Name string `json:"name"` // The name of the GitHub app + Slug string `json:"slug,omitempty"` // The slug name of the GitHub app + Client_id string `json:"client_id,omitempty"` + Html_url string `json:"html_url"` + Node_id string `json:"node_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Title string `json:"title,omitempty"` - Url string `json:"url,omitempty"` - Created_at string `json:"created_at,omitempty"` - Id int `json:"id,omitempty"` - Key string `json:"key"` // The Base64 encoded public key. - Key_id string `json:"key_id"` // The identifier for the key. +// GeneratedType_Webhook_discussion_pinned represents the GeneratedType_Webhook_discussion_pinned schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_pinned struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` - Path string `json:"path"` - Commit_id string `json:"commit_id"` - Node_id string `json:"node_id"` +// GeneratedType_Code_of_conduct_simple represents the GeneratedType_Code_of_conduct_simple schema from the OpenAPI specification +type GeneratedType_Code_of_conduct_simple struct { + Name string `json:"name"` Url string `json:"url"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Line int `json:"line"` - Position int `json:"position"` - User GeneratedType `json:"user"` // A GitHub user. - Created_at string `json:"created_at"` Html_url string `json:"html_url"` - Reactions GeneratedType `json:"reactions,omitempty"` - Updated_at string `json:"updated_at"` - Body string `json:"body"` + Key string `json:"key"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Billable map[string]interface{} `json:"billable"` - Run_duration_ms int `json:"run_duration_ms,omitempty"` +// Webhooksrule represents the Webhooksrule schema from the OpenAPI specification +type Webhooksrule struct { + Required_status_checks_enforcement_level string `json:"required_status_checks_enforcement_level"` + Id int `json:"id"` + Pull_request_reviews_enforcement_level string `json:"pull_request_reviews_enforcement_level"` + Require_last_push_approval bool `json:"require_last_push_approval,omitempty"` // Whether the most recent push must be approved by someone other than the person who pushed it + Dismiss_stale_reviews_on_push bool `json:"dismiss_stale_reviews_on_push"` + Ignore_approvals_from_contributors bool `json:"ignore_approvals_from_contributors"` + Authorized_actor_names []string `json:"authorized_actor_names"` + Linear_history_requirement_enforcement_level string `json:"linear_history_requirement_enforcement_level"` + Allow_deletions_enforcement_level string `json:"allow_deletions_enforcement_level"` + Updated_at string `json:"updated_at"` + Merge_queue_enforcement_level string `json:"merge_queue_enforcement_level"` + Required_approving_review_count int `json:"required_approving_review_count"` + Required_deployments_enforcement_level string `json:"required_deployments_enforcement_level"` + Authorized_actors_only bool `json:"authorized_actors_only"` + Create_protected bool `json:"create_protected,omitempty"` + Repository_id int `json:"repository_id"` + Name string `json:"name"` + Allow_force_pushes_enforcement_level string `json:"allow_force_pushes_enforcement_level"` + Admin_enforced bool `json:"admin_enforced"` + Signature_requirement_enforcement_level string `json:"signature_requirement_enforcement_level"` + Authorized_dismissal_actors_only bool `json:"authorized_dismissal_actors_only"` + Created_at string `json:"created_at"` + Lock_branch_enforcement_level string `json:"lock_branch_enforcement_level"` // The enforcement level of the branch lock setting. `off` means the branch is not locked, `non_admins` means the branch is read-only for non_admins, and `everyone` means the branch is read-only for everyone. + Require_code_owner_review bool `json:"require_code_owner_review"` + Required_status_checks []string `json:"required_status_checks"` + Strict_required_status_checks_policy bool `json:"strict_required_status_checks_policy"` + Lock_allows_fork_sync bool `json:"lock_allows_fork_sync,omitempty"` // Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow users to pull changes from upstream when the branch is locked. This setting is only applicable for forks. + Required_conversation_resolution_level string `json:"required_conversation_resolution_level"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Property_name string `json:"property_name"` // The name of the property - Value string `json:"value"` // The value assigned to the property +// GeneratedType_Webhook_sponsorship_created represents the GeneratedType_Webhook_sponsorship_created schema from the OpenAPI specification +type GeneratedType_Webhook_sponsorship_created struct { + Sponsorship Webhookssponsorship `json:"sponsorship"` + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// Blob represents the Blob schema from the OpenAPI specification -type Blob struct { +// Authorization represents the Authorization schema from the OpenAPI specification +type Authorization struct { + Scopes []string `json:"scopes"` // A list of scopes that this authorization is in. + Note string `json:"note"` + App map[string]interface{} `json:"app"` Url string `json:"url"` - Content string `json:"content"` - Encoding string `json:"encoding"` - Highlighted_content string `json:"highlighted_content,omitempty"` - Node_id string `json:"node_id"` - Sha string `json:"sha"` - Size int `json:"size"` + Created_at string `json:"created_at"` + Id int64 `json:"id"` + Fingerprint string `json:"fingerprint"` + Token string `json:"token"` + Expires_at string `json:"expires_at"` + Updated_at string `json:"updated_at"` + Installation GeneratedType_Nullable_scoped_installation `json:"installation,omitempty"` + Note_url string `json:"note_url"` + User GeneratedType_Nullable_simple_user `json:"user,omitempty"` // A GitHub user. + Hashed_token string `json:"hashed_token"` + Token_last_eight string `json:"token_last_eight"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Organization_update_issue_type represents the GeneratedType_Organization_update_issue_type schema from the OpenAPI specification +type GeneratedType_Organization_update_issue_type struct { + Name string `json:"name"` // Name of the issue type. + Color string `json:"color,omitempty"` // Color for the issue type. + Description string `json:"description,omitempty"` // Description of the issue type. + Is_enabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Release Webhooksrelease1 `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Simple_classroom_user represents the GeneratedType_Simple_classroom_user schema from the OpenAPI specification +type GeneratedType_Simple_classroom_user struct { + Avatar_url string `json:"avatar_url"` + Html_url string `json:"html_url"` + Id int `json:"id"` + Login string `json:"login"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` +// GeneratedType_Repository_rule_required_linear_history represents the GeneratedType_Repository_rule_required_linear_history schema from the OpenAPI specification +type GeneratedType_Repository_rule_required_linear_history struct { TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project Webhooksproject `json:"project"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Org_membership represents the GeneratedType_Org_membership schema from the OpenAPI specification +type GeneratedType_Org_membership struct { + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Organization GeneratedType_Organization_simple `json:"organization"` // A GitHub organization. + Organization_url string `json:"organization_url"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Role string `json:"role"` // The user's membership type in the organization. + State string `json:"state"` // The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation. + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Security_severity_level string `json:"security_severity_level,omitempty"` // The security severity of the alert. - Description string `json:"description,omitempty"` // A short description of the rule used to detect the alert. - Help string `json:"help,omitempty"` // Detailed documentation for the rule as GitHub Flavored Markdown. - Id string `json:"id,omitempty"` // A unique identifier for the rule used to detect the alert. - Name string `json:"name,omitempty"` // The name of the rule used to detect the alert. - Severity string `json:"severity,omitempty"` // The severity of the alert. - Help_uri string `json:"help_uri,omitempty"` // A link to the documentation for the rule used to detect the alert. - Tags []string `json:"tags,omitempty"` // A set of tags applicable for the rule. - Full_description string `json:"full_description,omitempty"` // A description of the rule used to detect the alert. +// GeneratedType_Enterprise_webhooks represents the GeneratedType_Enterprise_webhooks schema from the OpenAPI specification +type GeneratedType_Enterprise_webhooks struct { + Id int `json:"id"` // Unique identifier of the enterprise + Name string `json:"name"` // The name of the enterprise. + Node_id string `json:"node_id"` + Html_url string `json:"html_url"` + Website_url string `json:"website_url,omitempty"` // The enterprise's website URL. + Description string `json:"description,omitempty"` // A short description of the enterprise. + Slug string `json:"slug"` // The slug url identifier for the enterprise. + Updated_at string `json:"updated_at"` + Avatar_url string `json:"avatar_url"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Public_user represents the GeneratedType_Public_user schema from the OpenAPI specification +type GeneratedType_Public_user struct { + Followers_url string `json:"followers_url"` + Avatar_url string `json:"avatar_url"` + Hireable bool `json:"hireable"` + Created_at string `json:"created_at"` + Owned_private_repos int `json:"owned_private_repos,omitempty"` + Updated_at string `json:"updated_at"` + Name string `json:"name"` + Html_url string `json:"html_url"` + Location string `json:"location"` + Events_url string `json:"events_url"` + Id int64 `json:"id"` + Private_gists int `json:"private_gists,omitempty"` + Disk_usage int `json:"disk_usage,omitempty"` + Gravatar_id string `json:"gravatar_id"` + Starred_url string `json:"starred_url"` + Followers int `json:"followers"` + User_view_type string `json:"user_view_type,omitempty"` + Twitter_username string `json:"twitter_username,omitempty"` + TypeField string `json:"type"` + Plan map[string]interface{} `json:"plan,omitempty"` + Collaborators int `json:"collaborators,omitempty"` + Bio string `json:"bio"` + Company string `json:"company"` + Site_admin bool `json:"site_admin"` + Node_id string `json:"node_id"` + Email string `json:"email"` + Repos_url string `json:"repos_url"` + Following int `json:"following"` + Received_events_url string `json:"received_events_url"` + Following_url string `json:"following_url"` + Organizations_url string `json:"organizations_url"` + Total_private_repos int `json:"total_private_repos,omitempty"` + Blog string `json:"blog"` + Public_gists int `json:"public_gists"` + Gists_url string `json:"gists_url"` + Login string `json:"login"` + Subscriptions_url string `json:"subscriptions_url"` + Public_repos int `json:"public_repos"` + Notification_email string `json:"notification_email,omitempty"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Cvss_v3 map[string]interface{} `json:"cvss_v3,omitempty"` - Cvss_v4 map[string]interface{} `json:"cvss_v4,omitempty"` +// GeneratedType_Deployment_branch_policy represents the GeneratedType_Deployment_branch_policy schema from the OpenAPI specification +type GeneratedType_Deployment_branch_policy struct { + Id int `json:"id,omitempty"` // The unique identifier of the branch or tag policy. + Name string `json:"name,omitempty"` // The name pattern that branches or tags must match in order to deploy to the environment. + Node_id string `json:"node_id,omitempty"` + TypeField string `json:"type,omitempty"` // Whether this rule targets a branch or tag. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - End_line int `json:"end_line,omitempty"` - Path string `json:"path,omitempty"` - Start_column int `json:"start_column,omitempty"` - Start_line int `json:"start_line,omitempty"` - End_column int `json:"end_column,omitempty"` +// GeneratedType_Pages_https_certificate represents the GeneratedType_Pages_https_certificate schema from the OpenAPI specification +type GeneratedType_Pages_https_certificate struct { + Description string `json:"description"` + Domains []string `json:"domains"` // Array of the domain set and its alternate name (if it is configured) + Expires_at string `json:"expires_at,omitempty"` + State string `json:"state"` } -// Webhookscomment represents the Webhookscomment schema from the OpenAPI specification -type Webhookscomment struct { - Author_association string `json:"author_association"` // How the author is associated with the repository. - Body string `json:"body"` - Discussion_id int `json:"discussion_id"` +// GeneratedType_Code_scanning_autofix_commits_response represents the GeneratedType_Code_scanning_autofix_commits_response schema from the OpenAPI specification +type GeneratedType_Code_scanning_autofix_commits_response struct { + Sha string `json:"sha,omitempty"` // SHA of commit with autofix. + Target_ref string `json:"target_ref,omitempty"` // The Git reference of target branch for the commit. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation. +} + +// GeneratedType_Removed_from_project_issue_event represents the GeneratedType_Removed_from_project_issue_event schema from the OpenAPI specification +type GeneratedType_Removed_from_project_issue_event struct { + Project_card map[string]interface{} `json:"project_card,omitempty"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_id string `json:"commit_id"` + Created_at string `json:"created_at"` + Id int `json:"id"` Node_id string `json:"node_id"` - Parent_id int `json:"parent_id"` - Reactions map[string]interface{} `json:"reactions"` + Url string `json:"url"` + Event string `json:"event"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Commit_url string `json:"commit_url"` +} + +// GeneratedType_Issue_comment represents the GeneratedType_Issue_comment schema from the OpenAPI specification +type GeneratedType_Issue_comment struct { + Body_text string `json:"body_text,omitempty"` Updated_at string `json:"updated_at"` - Child_comment_count int `json:"child_comment_count"` + Url string `json:"url"` // URL for the issue comment Created_at string `json:"created_at"` + Id int64 `json:"id"` // Unique identifier of the issue comment + Issue_url string `json:"issue_url"` + Node_id string `json:"node_id"` + Body_html string `json:"body_html,omitempty"` Html_url string `json:"html_url"` - Id int `json:"id"` - Repository_url string `json:"repository_url"` - User map[string]interface{} `json:"user"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Author_association string `json:"author_association"` // How the author is associated with the repository. + Body string `json:"body,omitempty"` // Contents of the issue comment } -// Webhooksreview represents the Webhooksreview schema from the OpenAPI specification -type Webhooksreview struct { - Body string `json:"body"` // The text of the review. +// GeneratedType_Issue_search_result_item represents the GeneratedType_Issue_search_result_item schema from the OpenAPI specification +type GeneratedType_Issue_search_result_item struct { + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. State string `json:"state"` - Commit_id string `json:"commit_id"` // A commit SHA for the review. - Html_url string `json:"html_url"` - Id int `json:"id"` // Unique identifier of the review - Pull_request_url string `json:"pull_request_url"` - Submitted_at string `json:"submitted_at"` - User map[string]interface{} `json:"user"` + Body_html string `json:"body_html,omitempty"` + Pull_request map[string]interface{} `json:"pull_request,omitempty"` + Repository Repository `json:"repository,omitempty"` // A repository on GitHub. + Events_url string `json:"events_url"` + Id int64 `json:"id"` + Draft bool `json:"draft,omitempty"` + Body_text string `json:"body_text,omitempty"` + Closed_at string `json:"closed_at"` Node_id string `json:"node_id"` - Links map[string]interface{} `json:"_links"` + Number int `json:"number"` + Body string `json:"body,omitempty"` + Url string `json:"url"` + State_reason string `json:"state_reason,omitempty"` Author_association string `json:"author_association"` // How the author is associated with the repository. + Score float64 `json:"score"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Comments_url string `json:"comments_url"` + Updated_at string `json:"updated_at"` + Assignees []GeneratedType_Simple_user `json:"assignees,omitempty"` + Sub_issues_summary map[string]interface{} `json:"sub_issues_summary,omitempty"` + Locked bool `json:"locked"` + TypeField GeneratedType_Issue_type `json:"type,omitempty"` // The type of issue. + Created_at string `json:"created_at"` + Html_url string `json:"html_url"` + Labels []map[string]interface{} `json:"labels"` + Labels_url string `json:"labels_url"` + Timeline_url string `json:"timeline_url,omitempty"` + Active_lock_reason string `json:"active_lock_reason,omitempty"` + Comments int `json:"comments"` + Assignee GeneratedType_Nullable_simple_user `json:"assignee"` // A GitHub user. + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` + Milestone GeneratedType_Nullable_milestone `json:"milestone"` // A collection of related issues and pull requests. + Title string `json:"title"` + Repository_url string `json:"repository_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository map[string]interface{} `json:"repository,omitempty"` // A git repository - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. +// GeneratedType_Webhook_code_scanning_alert_closed_by_user represents the GeneratedType_Webhook_code_scanning_alert_closed_by_user schema from the OpenAPI specification +type GeneratedType_Webhook_code_scanning_alert_closed_by_user struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. Action string `json:"action"` + Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. + Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Teams []Team `json:"teams"` - Users []GeneratedType `json:"users"` +// GeneratedType_Hook_delivery_item represents the GeneratedType_Hook_delivery_item schema from the OpenAPI specification +type GeneratedType_Hook_delivery_item struct { + Id int64 `json:"id"` // Unique identifier of the webhook delivery. + Installation_id int64 `json:"installation_id"` // The id of the GitHub App installation associated with this event. + Status_code int `json:"status_code"` // Status code received when delivery was made. + Delivered_at string `json:"delivered_at"` // Time when the webhook delivery occurred. + Guid string `json:"guid"` // Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event). + Redelivery bool `json:"redelivery"` // Whether the webhook delivery is a redelivery. + Repository_id int64 `json:"repository_id"` // The id of the repository associated with this event. + Event string `json:"event"` // The event that triggered the delivery. + Action string `json:"action"` // The type of activity for the event that triggered the delivery. + Status string `json:"status"` // Describes the response returned after attempting the delivery. + Throttled_at string `json:"throttled_at,omitempty"` // Time when the webhook delivery was throttled. + Duration float64 `json:"duration"` // Time spent delivering. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit map[string]interface{} `json:"commit"` - Content map[string]interface{} `json:"content"` +// GeneratedType_Actions_secret represents the GeneratedType_Actions_secret schema from the OpenAPI specification +type GeneratedType_Actions_secret struct { + Updated_at string `json:"updated_at"` + Created_at string `json:"created_at"` + Name string `json:"name"` // The name of the secret. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue Webhooksissue2 `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_marketplace_purchase_pending_change_cancelled represents the GeneratedType_Webhook_marketplace_purchase_pending_change_cancelled schema from the OpenAPI specification +type GeneratedType_Webhook_marketplace_purchase_pending_change_cancelled struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Previous_marketplace_purchase Webhookspreviousmarketplacepurchase `json:"previous_marketplace_purchase,omitempty"` + Marketplace_purchase map[string]interface{} `json:"marketplace_purchase"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Effective_date string `json:"effective_date"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Rule Webhooksrule `json:"rule"` // The branch protection rule. Includes a `name` and all the [branch protection settings](https://docs.github.com/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-settings) applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of `off`, `non_admins`, or `everyone`. Actor and build lists are arrays of strings. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Simple_user represents the GeneratedType_Simple_user schema from the OpenAPI specification +type GeneratedType_Simple_user struct { + Repos_url string `json:"repos_url"` + Starred_at string `json:"starred_at,omitempty"` + Id int64 `json:"id"` + Login string `json:"login"` + Node_id string `json:"node_id"` + Url string `json:"url"` + Events_url string `json:"events_url"` + Following_url string `json:"following_url"` + Html_url string `json:"html_url"` + Subscriptions_url string `json:"subscriptions_url"` + Name string `json:"name,omitempty"` + Starred_url string `json:"starred_url"` + User_view_type string `json:"user_view_type,omitempty"` + Avatar_url string `json:"avatar_url"` + Gists_url string `json:"gists_url"` + Email string `json:"email,omitempty"` + Site_admin bool `json:"site_admin"` + Gravatar_id string `json:"gravatar_id"` + TypeField string `json:"type"` + Organizations_url string `json:"organizations_url"` + Followers_url string `json:"followers_url"` + Received_events_url string `json:"received_events_url"` +} + +// GeneratedType_Webhook_code_scanning_alert_fixed represents the GeneratedType_Webhook_code_scanning_alert_fixed schema from the OpenAPI specification +type GeneratedType_Webhook_code_scanning_alert_fixed struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Payload string `json:"payload"` // A URL-encoded string of the check_run.rerequested JSON payload. The decoded payload is a JSON object. +// GeneratedType_Repository_rule_pull_request represents the GeneratedType_Repository_rule_pull_request schema from the OpenAPI specification +type GeneratedType_Repository_rule_pull_request struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - PackageField map[string]interface{} `json:"package"` // Information about the package. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Repository_rule_deletion represents the GeneratedType_Repository_rule_deletion schema from the OpenAPI specification +type GeneratedType_Repository_rule_deletion struct { + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Repository_rule_commit_author_email_pattern represents the GeneratedType_Repository_rule_commit_author_email_pattern schema from the OpenAPI specification +type GeneratedType_Repository_rule_commit_author_email_pattern struct { + TypeField string `json:"type"` + Parameters map[string]interface{} `json:"parameters,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository map[string]interface{} `json:"repository,omitempty"` // A git repository - Sender GeneratedType `json:"sender"` // A GitHub user. - Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. +// GeneratedType_Protected_branch_required_status_check represents the GeneratedType_Protected_branch_required_status_check schema from the OpenAPI specification +type GeneratedType_Protected_branch_required_status_check struct { + Contexts []string `json:"contexts"` + Contexts_url string `json:"contexts_url,omitempty"` + Enforcement_level string `json:"enforcement_level,omitempty"` + Strict bool `json:"strict,omitempty"` + Url string `json:"url,omitempty"` + Checks []map[string]interface{} `json:"checks"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Content string `json:"content"` - Url string `json:"url"` - Encoding string `json:"encoding"` - License GeneratedType `json:"license"` // License Simple - Name string `json:"name"` - Git_url string `json:"git_url"` - Path string `json:"path"` - Size int `json:"size"` - TypeField string `json:"type"` - Links map[string]interface{} `json:"_links"` - Download_url string `json:"download_url"` - Html_url string `json:"html_url"` - Sha string `json:"sha"` +// Webhookssecurityadvisory represents the Webhookssecurityadvisory schema from the OpenAPI specification +type Webhookssecurityadvisory struct { + References []map[string]interface{} `json:"references"` + Summary string `json:"summary"` + Description string `json:"description"` + Ghsa_id string `json:"ghsa_id"` + Withdrawn_at string `json:"withdrawn_at"` + Identifiers []map[string]interface{} `json:"identifiers"` + Severity string `json:"severity"` + Updated_at string `json:"updated_at"` + Vulnerabilities []map[string]interface{} `json:"vulnerabilities"` + Cvss map[string]interface{} `json:"cvss"` + Cvss_severities GeneratedType_Cvss_severities `json:"cvss_severities,omitempty"` + Cwes []map[string]interface{} `json:"cwes"` + Published_at string `json:"published_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Repository_rule_creation represents the GeneratedType_Repository_rule_creation schema from the OpenAPI specification +type GeneratedType_Repository_rule_creation struct { + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Permission string `json:"permission"` - Role_name string `json:"role_name"` - User GeneratedType `json:"user"` // Collaborator +// Key represents the Key schema from the OpenAPI specification +type Key struct { + Read_only bool `json:"read_only"` + Title string `json:"title"` + Url string `json:"url"` + Verified bool `json:"verified"` + Created_at string `json:"created_at"` + Id int64 `json:"id"` + Key string `json:"key"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alert map[string]interface{} `json:"alert"` // The security alert of the vulnerable dependency. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_project_edited represents the GeneratedType_Webhook_project_edited schema from the OpenAPI specification +type GeneratedType_Webhook_project_edited struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` + Changes map[string]interface{} `json:"changes,omitempty"` // The changes to the project if the action was `edited`. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project Webhooksproject `json:"project"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Severity string `json:"severity"` // The severity of the advisory. - Ghsa_id string `json:"ghsa_id"` // The unique GitHub Security Advisory ID assigned to the advisory. - References []map[string]interface{} `json:"references"` // Links to additional advisory information. - Cwes []map[string]interface{} `json:"cwes"` // Details for the advisory pertaining to Common Weakness Enumeration. - Updated_at string `json:"updated_at"` // The time that the advisory was last modified in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Identifiers []map[string]interface{} `json:"identifiers"` // Values that identify this advisory among security information sources. - Withdrawn_at string `json:"withdrawn_at"` // The time that the advisory was withdrawn in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Cvss map[string]interface{} `json:"cvss"` // Details for the advisory pertaining to the Common Vulnerability Scoring System. - Epss GeneratedType `json:"epss,omitempty"` // The EPSS scores as calculated by the [Exploit Prediction Scoring System](https://www.first.org/epss). - Cve_id string `json:"cve_id"` // The unique CVE ID assigned to the advisory. - Cvss_severities GeneratedType `json:"cvss_severities,omitempty"` - Vulnerabilities []GeneratedType `json:"vulnerabilities"` // Vulnerable version range information for the advisory. - Summary string `json:"summary"` // A short, plain text summary of the advisory. - Description string `json:"description"` // A long-form Markdown-supported description of the advisory. - Published_at string `json:"published_at"` // The time that the advisory was published in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. +// GeneratedType_Codespaces_user_public_key represents the GeneratedType_Codespaces_user_public_key schema from the OpenAPI specification +type GeneratedType_Codespaces_user_public_key struct { + Key_id string `json:"key_id"` // The identifier for the key. + Key string `json:"key"` // The Base64 encoded public key. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_id int `json:"repository_id"` // The ID of the repository where the workflow is defined - Sha string `json:"sha,omitempty"` // The commit SHA of the workflow file to use - Path string `json:"path"` // The path to the workflow file - Ref string `json:"ref,omitempty"` // The ref (branch or tag) of the workflow file to use +// GeneratedType_Custom_property_set_payload represents the GeneratedType_Custom_property_set_payload schema from the OpenAPI specification +type GeneratedType_Custom_property_set_payload struct { + Values_editable_by string `json:"values_editable_by,omitempty"` // Who can edit the values of the property + Allowed_values []string `json:"allowed_values,omitempty"` // An ordered list of the allowed values of the property. The property can have up to 200 allowed values. + Default_value string `json:"default_value,omitempty"` // Default value of the property + Description string `json:"description,omitempty"` // Short description of the property + Required bool `json:"required,omitempty"` // Whether the property is required. + Value_type string `json:"value_type"` // The type of the value for the property } -// Event represents the Event schema from the OpenAPI specification -type Event struct { - Org Actor `json:"org,omitempty"` // Actor - Payload map[string]interface{} `json:"payload"` - Public bool `json:"public"` - Repo map[string]interface{} `json:"repo"` - TypeField string `json:"type"` - Actor Actor `json:"actor"` // Actor +// GeneratedType_Review_comment represents the GeneratedType_Review_comment schema from the OpenAPI specification +type GeneratedType_Review_comment struct { + Original_commit_id string `json:"original_commit_id"` + Updated_at string `json:"updated_at"` Created_at string `json:"created_at"` - Id string `json:"id"` + Body_text string `json:"body_text,omitempty"` + Body_html string `json:"body_html,omitempty"` + Diff_hunk string `json:"diff_hunk"` + Original_position int `json:"original_position"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Links map[string]interface{} `json:"_links"` + Subject_type string `json:"subject_type,omitempty"` // The level at which the comment is targeted, can be a diff line or a file. + Original_line int `json:"original_line,omitempty"` // The original line of the blob to which the comment applies. The last line of the range for a multi-line comment + Original_start_line int `json:"original_start_line,omitempty"` // The original first line of the range for a multi-line comment. + Node_id string `json:"node_id"` + Start_side string `json:"start_side,omitempty"` // The side of the first line of the range for a multi-line comment. + In_reply_to_id int `json:"in_reply_to_id,omitempty"` + Url string `json:"url"` + Line int `json:"line,omitempty"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment + Commit_id string `json:"commit_id"` + Side string `json:"side,omitempty"` // The side of the first line of the range for a multi-line comment. + Body string `json:"body"` + Pull_request_review_id int64 `json:"pull_request_review_id"` + Html_url string `json:"html_url"` + Pull_request_url string `json:"pull_request_url"` + Id int64 `json:"id"` + Start_line int `json:"start_line,omitempty"` // The first line of the range for a multi-line comment. + Path string `json:"path"` + Position int `json:"position"` + Author_association string `json:"author_association"` // How the author is associated with the repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_property map[string]interface{} `json:"repository_property"` +// GeneratedType_Webhook_project_column_moved represents the GeneratedType_Webhook_project_column_moved schema from the OpenAPI specification +type GeneratedType_Webhook_project_column_moved struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_column Webhooksprojectcolumn `json:"project_column"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enabled bool `json:"enabled"` +// GeneratedType_Organization_simple_webhooks represents the GeneratedType_Organization_simple_webhooks schema from the OpenAPI specification +type GeneratedType_Organization_simple_webhooks struct { + Login string `json:"login"` + Members_url string `json:"members_url"` + Node_id string `json:"node_id"` + Repos_url string `json:"repos_url"` + Description string `json:"description"` + Public_members_url string `json:"public_members_url"` Url string `json:"url"` + Avatar_url string `json:"avatar_url"` + Issues_url string `json:"issues_url"` + Events_url string `json:"events_url"` + Hooks_url string `json:"hooks_url"` + Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Selected_actions_url string `json:"selected_actions_url,omitempty"` // The API URL to use to get or set the actions and reusable workflows that are allowed to run, when `allowed_actions` is set to `selected`. - Allowed_actions string `json:"allowed_actions,omitempty"` // The permissions policy that controls the actions and reusable workflows that are allowed to run. - Enabled bool `json:"enabled"` // Whether GitHub Actions is enabled on the repository. +// GeneratedType_Nullable_simple_commit represents the GeneratedType_Nullable_simple_commit schema from the OpenAPI specification +type GeneratedType_Nullable_simple_commit struct { + Committer map[string]interface{} `json:"committer"` // Information about the Git committer + Id string `json:"id"` // SHA for the commit + Message string `json:"message"` // Message describing the purpose of the commit + Timestamp string `json:"timestamp"` // Timestamp of the commit + Tree_id string `json:"tree_id"` // SHA for the commit's tree + Author map[string]interface{} `json:"author"` // Information about the Git author } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_column Webhooksprojectcolumn `json:"project_column"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Webhook_check_run_created_form_encoded represents the GeneratedType_Webhook_check_run_created_form_encoded schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_created_form_encoded struct { + Payload string `json:"payload"` // A URL-encoded string of the check_run.created JSON payload. The decoded payload is a JSON object. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request GeneratedType `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Private_vulnerability_report_create represents the GeneratedType_Private_vulnerability_report_create schema from the OpenAPI specification +type GeneratedType_Private_vulnerability_report_create struct { + Vulnerabilities []map[string]interface{} `json:"vulnerabilities,omitempty"` // An array of products affected by the vulnerability detailed in a repository security advisory. + Cvss_vector_string string `json:"cvss_vector_string,omitempty"` // The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`. + Cwe_ids []string `json:"cwe_ids,omitempty"` // A list of Common Weakness Enumeration (CWE) IDs. + Description string `json:"description"` // A detailed description of what the advisory impacts. + Severity string `json:"severity,omitempty"` // The severity of the advisory. You must choose between setting this field or `cvss_vector_string`. + Start_private_fork bool `json:"start_private_fork,omitempty"` // Whether to create a temporary private fork of the repository to collaborate on a fix. + Summary string `json:"summary"` // A short summary of the advisory. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Count int `json:"count"` - Referrer string `json:"referrer"` - Uniques int `json:"uniques"` +// GeneratedType_Nullable_code_of_conduct_simple represents the GeneratedType_Nullable_code_of_conduct_simple schema from the OpenAPI specification +type GeneratedType_Nullable_code_of_conduct_simple struct { + Name string `json:"name"` + Url string `json:"url"` + Html_url string `json:"html_url"` + Key string `json:"key"` } -// Repository represents the Repository schema from the OpenAPI specification -type Repository struct { - Has_projects bool `json:"has_projects"` // Whether projects are enabled. - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits - Issue_comment_url string `json:"issue_comment_url"` - Topics []string `json:"topics,omitempty"` +// GeneratedType_License_simple represents the GeneratedType_License_simple schema from the OpenAPI specification +type GeneratedType_License_simple struct { + Url string `json:"url"` + Html_url string `json:"html_url,omitempty"` + Key string `json:"key"` + Name string `json:"name"` Node_id string `json:"node_id"` - Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). - Merges_url string `json:"merges_url"` - Has_issues bool `json:"has_issues"` // Whether issues are enabled. - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. - Comments_url string `json:"comments_url"` - Languages_url string `json:"languages_url"` - Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). - Permissions map[string]interface{} `json:"permissions,omitempty"` - Description string `json:"description"` - Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. - Git_tags_url string `json:"git_tags_url"` - Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. - Master_branch string `json:"master_branch,omitempty"` - Open_issues_count int `json:"open_issues_count"` - Teams_url string `json:"teams_url"` + Spdx_id string `json:"spdx_id"` +} + +// GeneratedType_Webhook_discussion_created represents the GeneratedType_Webhook_discussion_created schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_created struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +} + +// GeneratedType_Webhook_label_deleted represents the GeneratedType_Webhook_label_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_label_deleted struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Label Webhookslabel `json:"label"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +} + +// GeneratedType_Nullable_repository represents the GeneratedType_Nullable_repository schema from the OpenAPI specification +type GeneratedType_Nullable_repository struct { Collaborators_url string `json:"collaborators_url"` - Fork bool `json:"fork"` + Private bool `json:"private"` // Whether the repository is private or public. + Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Forks_count int `json:"forks_count"` Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. - Has_pages bool `json:"has_pages"` - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. - Deployments_url string `json:"deployments_url"` - Labels_url string `json:"labels_url"` - Pushed_at string `json:"pushed_at"` - Archive_url string `json:"archive_url"` - Subscription_url string `json:"subscription_url"` - Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. - Statuses_url string `json:"statuses_url"` - Id int64 `json:"id"` // Unique identifier of the repository - License GeneratedType `json:"license"` // License Simple + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. + Issues_url string `json:"issues_url"` + Languages_url string `json:"languages_url"` Pulls_url string `json:"pulls_url"` + Svn_url string `json:"svn_url"` + Id int64 `json:"id"` // Unique identifier of the repository + Topics []string `json:"topics,omitempty"` Subscribers_url string `json:"subscribers_url"` - Forks_count int `json:"forks_count"` - Mirror_url string `json:"mirror_url"` - Tags_url string `json:"tags_url"` - Updated_at string `json:"updated_at"` - Code_search_index_status map[string]interface{} `json:"code_search_index_status,omitempty"` // The status of the code search index for this repository - Watchers_count int `json:"watchers_count"` - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. - Contributors_url string `json:"contributors_url"` - Commits_url string `json:"commits_url"` + Issue_events_url string `json:"issue_events_url"` + Notifications_url string `json:"notifications_url"` + Open_issues int `json:"open_issues"` + Created_at string `json:"created_at"` + Milestones_url string `json:"milestones_url"` + Watchers int `json:"watchers"` + Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). + Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). Git_url string `json:"git_url"` - Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. - Name string `json:"name"` // The name of the repository. - Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. - Svn_url string `json:"svn_url"` - Stargazers_url string `json:"stargazers_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. - Branches_url string `json:"branches_url"` - Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. - Releases_url string `json:"releases_url"` - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Merges_url string `json:"merges_url"` + Commits_url string `json:"commits_url"` Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. - Git_refs_url string `json:"git_refs_url"` - Html_url string `json:"html_url"` - Issues_url string `json:"issues_url"` + Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. + Pushed_at string `json:"pushed_at"` Archived bool `json:"archived"` // Whether the repository is archived. + Contents_url string `json:"contents_url"` + Mirror_url string `json:"mirror_url"` + Node_id string `json:"node_id"` + Stargazers_count int `json:"stargazers_count"` + Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo + Downloads_url string `json:"downloads_url"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged + Git_refs_url string `json:"git_refs_url"` + Has_projects bool `json:"has_projects"` // Whether projects are enabled. + Statuses_url string `json:"statuses_url"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Releases_url string `json:"releases_url"` + Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository + Git_commits_url string `json:"git_commits_url"` + Tags_url string `json:"tags_url"` + Has_pages bool `json:"has_pages"` + Contributors_url string `json:"contributors_url"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Master_branch string `json:"master_branch,omitempty"` + Updated_at string `json:"updated_at"` Ssh_url string `json:"ssh_url"` - Watchers int `json:"watchers"` Compare_url string `json:"compare_url"` - Open_issues int `json:"open_issues"` - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. - Url string `json:"url"` + Comments_url string `json:"comments_url"` + Deployments_url string `json:"deployments_url"` Keys_url string `json:"keys_url"` - Milestones_url string `json:"milestones_url"` - Starred_at string `json:"starred_at,omitempty"` - Created_at string `json:"created_at"` - Language string `json:"language"` - Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged - Forks int `json:"forks"` + Default_branch string `json:"default_branch"` // The default branch of the repository. + Open_issues_count int `json:"open_issues_count"` + Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. + Assignees_url string `json:"assignees_url"` + Code_search_index_status map[string]interface{} `json:"code_search_index_status,omitempty"` // The status of the code search index for this repository + Blobs_url string `json:"blobs_url"` Trees_url string `json:"trees_url"` - Hooks_url string `json:"hooks_url"` - Issue_events_url string `json:"issue_events_url"` - Owner GeneratedType `json:"owner"` // A GitHub user. + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Events_url string `json:"events_url"` + Fork bool `json:"fork"` + Url string `json:"url"` + Forks int `json:"forks"` + Watchers_count int `json:"watchers_count"` + Has_issues bool `json:"has_issues"` // Whether issues are enabled. + Description string `json:"description"` + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. + Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. + Issue_comment_url string `json:"issue_comment_url"` Full_name string `json:"full_name"` - Homepage string `json:"homepage"` - Blobs_url string `json:"blobs_url"` + Stargazers_url string `json:"stargazers_url"` + Git_tags_url string `json:"git_tags_url"` + Hooks_url string `json:"hooks_url"` + Teams_url string `json:"teams_url"` + Events_url string `json:"events_url"` + Starred_at string `json:"starred_at,omitempty"` + Name string `json:"name"` // The name of the repository. + Labels_url string `json:"labels_url"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. Clone_url string `json:"clone_url"` - Default_branch string `json:"default_branch"` // The default branch of the repository. - Git_commits_url string `json:"git_commits_url"` - Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository - Assignees_url string `json:"assignees_url"` - Private bool `json:"private"` // Whether the repository is private or public. - Notifications_url string `json:"notifications_url"` - Stargazers_count int `json:"stargazers_count"` - Downloads_url string `json:"downloads_url"` - Contents_url string `json:"contents_url"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` + Homepage string `json:"homepage"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. + Branches_url string `json:"branches_url"` + Archive_url string `json:"archive_url"` Forks_url string `json:"forks_url"` + Language string `json:"language"` + Subscription_url string `json:"subscription_url"` + Html_url string `json:"html_url"` + Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_sponsorship_tier_changed represents the GeneratedType_Webhook_sponsorship_tier_changed schema from the OpenAPI specification +type GeneratedType_Webhook_sponsorship_tier_changed struct { + Sponsorship Webhookssponsorship `json:"sponsorship"` Action string `json:"action"` - Blocked_user Webhooksuser `json:"blocked_user"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Changes Webhookschanges8 `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - To string `json:"to"` - From string `json:"from"` +// Blob represents the Blob schema from the OpenAPI specification +type Blob struct { + Size int `json:"size"` + Url string `json:"url"` + Content string `json:"content"` + Encoding string `json:"encoding"` + Highlighted_content string `json:"highlighted_content,omitempty"` + Node_id string `json:"node_id"` + Sha string `json:"sha"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_status_update GeneratedType `json:"projects_v2_status_update"` // An status update belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_projects_v2_project_edited represents the GeneratedType_Webhook_projects_v2_project_edited schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_project_edited struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2 GeneratedType_Projects_v2 `json:"projects_v2"` // A projects v2 project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Changes map[string]interface{} `json:"changes"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Build map[string]interface{} `json:"build"` // The [List GitHub Pages builds](https://docs.github.com/rest/pages/pages#list-github-pages-builds) itself. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Id int `json:"id"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Actions_billing_usage represents the GeneratedType_Actions_billing_usage schema from the OpenAPI specification +type GeneratedType_Actions_billing_usage struct { + Included_minutes int `json:"included_minutes"` // The amount of free GitHub Actions minutes available. + Minutes_used_breakdown map[string]interface{} `json:"minutes_used_breakdown"` + Total_minutes_used int `json:"total_minutes_used"` // The sum of the free and paid GitHub Actions minutes used. + Total_paid_minutes_used int `json:"total_paid_minutes_used"` // The total paid GitHub Actions minutes used. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation Installation `json:"installation"` // Installation - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories_removed []map[string]interface{} `json:"repositories_removed"` // An array of repository objects, which were removed from the installation. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requester Webhooksuser `json:"requester"` - Repositories_added []map[string]interface{} `json:"repositories_added"` // An array of repository objects, which were added to the installation. - Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_personal_access_token_request_approved represents the GeneratedType_Webhook_personal_access_token_request_approved schema from the OpenAPI specification +type GeneratedType_Webhook_personal_access_token_request_approved struct { Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Personal_access_token_request GeneratedType_Personal_access_token_request `json:"personal_access_token_request"` // Details of a Personal Access Token Request. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Size int `json:"size"` - Oid string `json:"oid"` - Path string `json:"path"` - Ref_name string `json:"ref_name"` +// GeneratedType_Runner_label represents the GeneratedType_Runner_label schema from the OpenAPI specification +type GeneratedType_Runner_label struct { + Id int `json:"id,omitempty"` // Unique identifier of the label. + Name string `json:"name"` // Name of the label. + TypeField string `json:"type,omitempty"` // The type of label. Read-only labels are applied automatically when the runner is configured. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Team_membership represents the GeneratedType_Team_membership schema from the OpenAPI specification +type GeneratedType_Team_membership struct { + Url string `json:"url"` + Role string `json:"role"` // The role of the user in the team. + State string `json:"state"` // The state of the user's membership in the team. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Release Webhooksrelease1 `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Code_scanning_variant_analysis_repository represents the GeneratedType_Code_scanning_variant_analysis_repository schema from the OpenAPI specification +type GeneratedType_Code_scanning_variant_analysis_repository struct { + Id int `json:"id"` // A unique identifier of the repository. + Name string `json:"name"` // The name of the repository. + Private bool `json:"private"` // Whether the repository is private. + Stargazers_count int `json:"stargazers_count"` + Updated_at string `json:"updated_at"` + Full_name string `json:"full_name"` // The full, globally unique, name of the repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Milestone Webhooksmilestone `json:"milestone,omitempty"` // A collection of related issues and pull requests. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// Hovercard represents the Hovercard schema from the OpenAPI specification +type Hovercard struct { + Contexts []map[string]interface{} `json:"contexts"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_milestone_created represents the GeneratedType_Webhook_milestone_created schema from the OpenAPI specification +type GeneratedType_Webhook_milestone_created struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Milestone Webhooksmilestone3 `json:"milestone"` // A collection of related issues and pull requests. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Alert GeneratedType `json:"alert"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Committer map[string]interface{} `json:"committer"` // Information about the Git committer - Id string `json:"id"` // SHA for the commit - Message string `json:"message"` // Message describing the purpose of the commit - Timestamp string `json:"timestamp"` // Timestamp of the commit - Tree_id string `json:"tree_id"` // SHA for the commit's tree - Author map[string]interface{} `json:"author"` // Information about the Git author +// GeneratedType_Webhook_ping_form_encoded represents the GeneratedType_Webhook_ping_form_encoded schema from the OpenAPI specification +type GeneratedType_Webhook_ping_form_encoded struct { + Payload string `json:"payload"` // A URL-encoded string of the ping JSON payload. The decoded payload is a JSON object. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id string `json:"id"` // The ID used for the `size` parameter when creating a new runner. - Memory_gb int `json:"memory_gb"` // The available RAM for the machine spec. - Storage_gb int `json:"storage_gb"` // The available SSD storage for the machine spec. - Cpu_cores int `json:"cpu_cores"` // The number of cores. +// GeneratedType_Webhook_workflow_job_queued represents the GeneratedType_Webhook_workflow_job_queued schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_job_queued struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow_job map[string]interface{} `json:"workflow_job"` + Action string `json:"action"` + Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Member Webhooksuser `json:"member"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_code_scanning_alert_reopened represents the GeneratedType_Webhook_code_scanning_alert_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_code_scanning_alert_reopened struct { + Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` - Id int64 `json:"id"` - Closed_at string `json:"closed_at"` - TypeField GeneratedType `json:"type,omitempty"` // The type of issue. - Labels_url string `json:"labels_url"` - Body_text string `json:"body_text,omitempty"` - Url string `json:"url"` // URL for the issue - Events_url string `json:"events_url"` - Body string `json:"body,omitempty"` // Contents of the issue - Draft bool `json:"draft,omitempty"` - Active_lock_reason string `json:"active_lock_reason,omitempty"` - Html_url string `json:"html_url"` - Comments int `json:"comments"` - Body_html string `json:"body_html,omitempty"` - Title string `json:"title"` // Title of the issue - Comments_url string `json:"comments_url"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Assignees []GeneratedType `json:"assignees,omitempty"` - Sub_issues_summary GeneratedType `json:"sub_issues_summary,omitempty"` - Timeline_url string `json:"timeline_url,omitempty"` - Repository_url string `json:"repository_url"` - Pull_request map[string]interface{} `json:"pull_request,omitempty"` - State_reason string `json:"state_reason,omitempty"` // The reason for the current state - Labels []interface{} `json:"labels"` // Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository - Author_association string `json:"author_association"` // How the author is associated with the repository. - Milestone GeneratedType `json:"milestone"` // A collection of related issues and pull requests. - State string `json:"state"` // State of the issue; either 'open' or 'closed' - Reactions GeneratedType `json:"reactions,omitempty"` - Repository Repository `json:"repository,omitempty"` // A repository on GitHub. +// GeneratedType_Actions_set_default_workflow_permissions represents the GeneratedType_Actions_set_default_workflow_permissions schema from the OpenAPI specification +type GeneratedType_Actions_set_default_workflow_permissions struct { + Can_approve_pull_request_reviews bool `json:"can_approve_pull_request_reviews,omitempty"` // Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. + Default_workflow_permissions string `json:"default_workflow_permissions,omitempty"` // The default workflow permissions granted to the GITHUB_TOKEN when running workflows. +} + +// GeneratedType_Release_asset represents the GeneratedType_Release_asset schema from the OpenAPI specification +type GeneratedType_Release_asset struct { + Download_count int `json:"download_count"` + Id int `json:"id"` + State string `json:"state"` // State of the release asset. Updated_at string `json:"updated_at"` - Closed_by GeneratedType `json:"closed_by,omitempty"` // A GitHub user. - Locked bool `json:"locked"` - Number int `json:"number"` // Number uniquely identifying the issue within its repository + Label string `json:"label"` Node_id string `json:"node_id"` - User GeneratedType `json:"user"` // A GitHub user. + Digest string `json:"digest"` + Name string `json:"name"` // The file name of the asset. + Size int `json:"size"` + Uploader GeneratedType_Nullable_simple_user `json:"uploader"` // A GitHub user. + Url string `json:"url"` + Browser_download_url string `json:"browser_download_url"` + Content_type string `json:"content_type"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Zen string `json:"zen,omitempty"` // Random string of GitHub zen. - Hook map[string]interface{} `json:"hook,omitempty"` // The webhook that is being pinged - Hook_id int `json:"hook_id,omitempty"` // The ID of the webhook that triggered the ping. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Repository_rule_committer_email_pattern represents the GeneratedType_Repository_rule_committer_email_pattern schema from the OpenAPI specification +type GeneratedType_Repository_rule_committer_email_pattern struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_discussion_comment_created represents the GeneratedType_Webhook_discussion_comment_created schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_comment_created struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pending_operation bool `json:"pending_operation,omitempty"` // Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it. - Location string `json:"location"` // The initally assigned location of a new codespace. - Start_url string `json:"start_url"` // API URL to start this codespace. - Idle_timeout_notice string `json:"idle_timeout_notice,omitempty"` // Text to show user when codespace idle timeout minutes has been overriden by an organization policy - Pending_operation_disabled_reason string `json:"pending_operation_disabled_reason,omitempty"` // Text to show user when codespace is disabled by a pending operation - State string `json:"state"` // State of this codespace. - Devcontainer_path string `json:"devcontainer_path,omitempty"` // Path to devcontainer.json from repo root used to create Codespace. - Runtime_constraints map[string]interface{} `json:"runtime_constraints,omitempty"` - Pulls_url string `json:"pulls_url"` // API URL for the Pull Request associated with this codespace, if any. - Machine GeneratedType `json:"machine"` // A description of the machine powering a codespace. - Prebuild bool `json:"prebuild"` // Whether the codespace was created from a prebuild. - Updated_at string `json:"updated_at"` - Display_name string `json:"display_name,omitempty"` // Display name for this codespace. - Name string `json:"name"` // Automatically generated name of this codespace. - Id int64 `json:"id"` - Retention_expires_at string `json:"retention_expires_at,omitempty"` // When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at" - Idle_timeout_minutes int `json:"idle_timeout_minutes"` // The number of minutes of inactivity after which this codespace will be automatically stopped. - Stop_url string `json:"stop_url"` // API URL to stop this codespace. - Recent_folders []string `json:"recent_folders"` - Environment_id string `json:"environment_id"` // UUID identifying this codespace's environment. - Last_used_at string `json:"last_used_at"` // Last known time this codespace was started. - Web_url string `json:"web_url"` // URL to access this codespace on the web. - Repository GeneratedType `json:"repository"` // Full Repository - Owner GeneratedType `json:"owner"` // A GitHub user. - Machines_url string `json:"machines_url"` // API URL to access available alternate machine types for this codespace. - Publish_url string `json:"publish_url,omitempty"` // API URL to publish this codespace to a new repository. - Url string `json:"url"` // API URL for this codespace. - Billable_owner GeneratedType `json:"billable_owner"` // A GitHub user. - Git_status map[string]interface{} `json:"git_status"` // Details about the codespace's git repository. - Retention_period_minutes int `json:"retention_period_minutes,omitempty"` // Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). - Created_at string `json:"created_at"` + Comment Webhookscomment `json:"comment"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Changes map[string]interface{} `json:"changes"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender"` // A GitHub user. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Review Webhooksreview `json:"review"` // The review that was affected. +// GeneratedType_Webhook_repository_advisory_published represents the GeneratedType_Webhook_repository_advisory_published schema from the OpenAPI specification +type GeneratedType_Webhook_repository_advisory_published struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Repository_advisory GeneratedType_Repository_advisory `json:"repository_advisory"` // A repository security advisory. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Active_caches_count int `json:"active_caches_count"` // The number of active caches in the repository. - Active_caches_size_in_bytes int `json:"active_caches_size_in_bytes"` // The sum of the size in bytes of all the active cache items in the repository. - Full_name string `json:"full_name"` // The repository owner and name for the cache usage being shown. +// Webhookschanges8 represents the Webhookschanges8 schema from the OpenAPI specification +type Webhookschanges8 struct { + Tier map[string]interface{} `json:"tier"` } -// Key represents the Key schema from the OpenAPI specification -type Key struct { +// GeneratedType_Ssh_signing_key represents the GeneratedType_Ssh_signing_key schema from the OpenAPI specification +type GeneratedType_Ssh_signing_key struct { + Id int `json:"id"` Key string `json:"key"` - Read_only bool `json:"read_only"` Title string `json:"title"` - Url string `json:"url"` - Verified bool `json:"verified"` Created_at string `json:"created_at"` +} + +// Collaborator represents the Collaborator schema from the OpenAPI specification +type Collaborator struct { + Html_url string `json:"html_url"` + Following_url string `json:"following_url"` + Gravatar_id string `json:"gravatar_id"` + Repos_url string `json:"repos_url"` + TypeField string `json:"type"` Id int64 `json:"id"` + Url string `json:"url"` + User_view_type string `json:"user_view_type,omitempty"` + Events_url string `json:"events_url"` + Organizations_url string `json:"organizations_url"` + Email string `json:"email,omitempty"` + Starred_url string `json:"starred_url"` + Received_events_url string `json:"received_events_url"` + Subscriptions_url string `json:"subscriptions_url"` + Login string `json:"login"` + Site_admin bool `json:"site_admin"` + Gists_url string `json:"gists_url"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Role_name string `json:"role_name"` + Name string `json:"name,omitempty"` + Followers_url string `json:"followers_url"` + Node_id string `json:"node_id"` + Avatar_url string `json:"avatar_url"` +} + +// Traffic represents the Traffic schema from the OpenAPI specification +type Traffic struct { + Count int `json:"count"` + Timestamp string `json:"timestamp"` + Uniques int `json:"uniques"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_repository_created represents the GeneratedType_Webhook_repository_created schema from the OpenAPI specification +type GeneratedType_Webhook_repository_created struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Sender GeneratedType `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` - Last_used string `json:"last_used,omitempty"` - Title string `json:"title"` - Url string `json:"url"` - Created_at string `json:"created_at"` - Verified bool `json:"verified"` - Added_by string `json:"added_by,omitempty"` - Key string `json:"key"` - Read_only bool `json:"read_only"` - Enabled bool `json:"enabled,omitempty"` +// GeneratedType_Webhook_repository_unarchived represents the GeneratedType_Webhook_repository_unarchived schema from the OpenAPI specification +type GeneratedType_Webhook_repository_unarchived struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id"` - Description string `json:"description"` - State string `json:"state"` // The state of the milestone. - Closed_issues int `json:"closed_issues"` - Creator GeneratedType `json:"creator"` // A GitHub user. - Updated_at string `json:"updated_at"` - Closed_at string `json:"closed_at"` - Id int `json:"id"` - Open_issues int `json:"open_issues"` - Due_on string `json:"due_on"` - Labels_url string `json:"labels_url"` - Html_url string `json:"html_url"` - Title string `json:"title"` // The title of the milestone. - Url string `json:"url"` - Created_at string `json:"created_at"` - Number int `json:"number"` // The number of the milestone. +// GeneratedType_Repository_rule_non_fast_forward represents the GeneratedType_Repository_rule_non_fast_forward schema from the OpenAPI specification +type GeneratedType_Repository_rule_non_fast_forward struct { + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Repository_rule_params_status_check_configuration represents the GeneratedType_Repository_rule_params_status_check_configuration schema from the OpenAPI specification +type GeneratedType_Repository_rule_params_status_check_configuration struct { + Context string `json:"context"` // The status check context name that must be present on the commit. + Integration_id int `json:"integration_id,omitempty"` // The optional integration ID that this status check must originate from. +} + +// GeneratedType_Repository_rule_params_reviewer represents the GeneratedType_Repository_rule_params_reviewer schema from the OpenAPI specification +type GeneratedType_Repository_rule_params_reviewer struct { + TypeField string `json:"type"` // The type of the reviewer + Id int `json:"id"` // ID of the reviewer which must review changes to matching files. +} + +// GeneratedType_Webhook_issues_demilestoned represents the GeneratedType_Webhook_issues_demilestoned schema from the OpenAPI specification +type GeneratedType_Webhook_issues_demilestoned struct { + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Milestone Webhooksmilestone `json:"milestone,omitempty"` // A collection of related issues and pull requests. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Members_url string `json:"members_url"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Repositories_url string `json:"repositories_url"` - Slug string `json:"slug"` - Parent GeneratedType `json:"parent"` // Groups of organization members that gives permissions on specified repositories. - Html_url string `json:"html_url"` - Node_id string `json:"node_id"` - Permission string `json:"permission"` - Assignment string `json:"assignment,omitempty"` // Determines if the team has a direct, indirect, or mixed relationship to a role +// GeneratedType_Simple_commit_status represents the GeneratedType_Simple_commit_status schema from the OpenAPI specification +type GeneratedType_Simple_commit_status struct { + Required bool `json:"required,omitempty"` + Target_url string `json:"target_url"` + Avatar_url string `json:"avatar_url"` Description string `json:"description"` - Notification_setting string `json:"notification_setting,omitempty"` - Id int `json:"id"` + Node_id string `json:"node_id"` + State string `json:"state"` Url string `json:"url"` - Name string `json:"name"` - Privacy string `json:"privacy,omitempty"` + Context string `json:"context"` + Created_at string `json:"created_at"` + Id int `json:"id"` + Updated_at string `json:"updated_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Days_left_in_billing_cycle int `json:"days_left_in_billing_cycle"` // Numbers of days left in billing cycle. - Estimated_paid_storage_for_month int `json:"estimated_paid_storage_for_month"` // Estimated storage space (GB) used in billing cycle. - Estimated_storage_for_month int `json:"estimated_storage_for_month"` // Estimated sum of free and paid storage space (GB) used in billing cycle. +// GeneratedType_Actions_organization_permissions represents the GeneratedType_Actions_organization_permissions schema from the OpenAPI specification +type GeneratedType_Actions_organization_permissions struct { + Enabled_repositories string `json:"enabled_repositories"` // The policy that controls the repositories in the organization that are allowed to run GitHub Actions. + Selected_actions_url string `json:"selected_actions_url,omitempty"` // The API URL to use to get or set the actions and reusable workflows that are allowed to run, when `allowed_actions` is set to `selected`. + Selected_repositories_url string `json:"selected_repositories_url,omitempty"` // The API URL to use to get or set the selected repositories that are allowed to run GitHub Actions, when `enabled_repositories` is set to `selected`. + Allowed_actions string `json:"allowed_actions,omitempty"` // The permissions policy that controls the actions and reusable workflows that are allowed to run. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Gitignore_template represents the GeneratedType_Gitignore_template schema from the OpenAPI specification +type GeneratedType_Gitignore_template struct { + Source string `json:"source"` + Name string `json:"name"` +} + +// GeneratedType_Webhook_project_reopened represents the GeneratedType_Webhook_project_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_project_reopened struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project Webhooksproject `json:"project"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Total_count int `json:"total_count"` - Url string `json:"url"` - Commit_url string `json:"commit_url"` - Repository GeneratedType `json:"repository"` // Minimal Repository - Sha string `json:"sha"` - State string `json:"state"` - Statuses []GeneratedType `json:"statuses"` +// GeneratedType_Rate_limit_overview represents the GeneratedType_Rate_limit_overview schema from the OpenAPI specification +type GeneratedType_Rate_limit_overview struct { + Resources map[string]interface{} `json:"resources"` + Rate GeneratedType_Rate_limit `json:"rate"` } -// Webhooksrelease1 represents the Webhooksrelease1 schema from the OpenAPI specification -type Webhooksrelease1 struct { - Created_at string `json:"created_at"` - Zipball_url string `json:"zipball_url"` - Author map[string]interface{} `json:"author"` - Discussion_url string `json:"discussion_url,omitempty"` - Published_at string `json:"published_at"` - Node_id string `json:"node_id"` - Reactions map[string]interface{} `json:"reactions,omitempty"` - Upload_url string `json:"upload_url"` +// GeneratedType_Status_check_policy represents the GeneratedType_Status_check_policy schema from the OpenAPI specification +type GeneratedType_Status_check_policy struct { Url string `json:"url"` - Name string `json:"name"` - Tag_name string `json:"tag_name"` // The name of the tag. - Assets_url string `json:"assets_url"` - Target_commitish string `json:"target_commitish"` // Specifies the commitish value that determines where the Git tag is created from. - Draft bool `json:"draft"` // Whether the release is a draft or published - Id int `json:"id"` - Body string `json:"body"` - Prerelease bool `json:"prerelease"` // Whether the release is identified as a prerelease or a full release. - Assets []map[string]interface{} `json:"assets"` - Html_url string `json:"html_url"` - Tarball_url string `json:"tarball_url"` + Checks []map[string]interface{} `json:"checks"` + Contexts []string `json:"contexts"` + Contexts_url string `json:"contexts_url"` + Strict bool `json:"strict"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Last_active_on string `json:"last_active_on,omitempty"` // The time at which the runner was last used, in ISO 8601 format. - Public_ips []GeneratedType `json:"public_ips,omitempty"` // The public IP ranges when public IP is enabled for the hosted runners. - Status string `json:"status"` // The status of the runner. - Image_details GeneratedType `json:"image_details"` // Provides details of a hosted runner image - Platform string `json:"platform"` // The operating system of the image. - Runner_group_id int `json:"runner_group_id,omitempty"` // The unique identifier of the group that the hosted runner belongs to. - Id int `json:"id"` // The unique identifier of the hosted runner. - Maximum_runners int `json:"maximum_runners,omitempty"` // The maximum amount of hosted runners. Runners will not scale automatically above this number. Use this setting to limit your cost. - Name string `json:"name"` // The name of the hosted runner. - Machine_size_details GeneratedType `json:"machine_size_details"` // Provides details of a particular machine spec. - Public_ip_enabled bool `json:"public_ip_enabled"` // Whether public IP is enabled for the hosted runners. +// GeneratedType_Webhook_watch_started represents the GeneratedType_Webhook_watch_started schema from the OpenAPI specification +type GeneratedType_Webhook_watch_started struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id"` - Html_url string `json:"html_url"` - Members_count int `json:"members_count"` - Repositories_url string `json:"repositories_url"` - Members_url string `json:"members_url"` - Repos_count int `json:"repos_count"` - Name string `json:"name"` // Name of the team - Description string `json:"description"` - Url string `json:"url"` // URL for the team - Updated_at string `json:"updated_at"` - Organization GeneratedType `json:"organization"` // Team Organization - Id int `json:"id"` // Unique identifier of the team - Permission string `json:"permission"` // Permission that the team will have for its repositories - Privacy string `json:"privacy,omitempty"` // The level of privacy this team should have - Created_at string `json:"created_at"` - Ldap_dn string `json:"ldap_dn,omitempty"` // Distinguished Name (DN) that team maps to within LDAP environment - Notification_setting string `json:"notification_setting,omitempty"` // The notification setting the team has set - Slug string `json:"slug"` - Parent GeneratedType `json:"parent,omitempty"` // Groups of organization members that gives permissions on specified repositories. +// GeneratedType_Repository_rule_branch_name_pattern represents the GeneratedType_Repository_rule_branch_name_pattern schema from the OpenAPI specification +type GeneratedType_Repository_rule_branch_name_pattern struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2 GeneratedType `json:"projects_v2"` // A projects v2 project - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_projects_v2_item_converted represents the GeneratedType_Webhook_projects_v2_item_converted schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_converted struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project } -// Webhooksusermannequin represents the Webhooksusermannequin schema from the OpenAPI specification -type Webhooksusermannequin struct { - Id int `json:"id"` - Organizations_url string `json:"organizations_url,omitempty"` - Subscriptions_url string `json:"subscriptions_url,omitempty"` - Url string `json:"url,omitempty"` - Email string `json:"email,omitempty"` - Following_url string `json:"following_url,omitempty"` - Starred_url string `json:"starred_url,omitempty"` - Events_url string `json:"events_url,omitempty"` - User_view_type string `json:"user_view_type,omitempty"` - Deleted bool `json:"deleted,omitempty"` - Html_url string `json:"html_url,omitempty"` - Node_id string `json:"node_id,omitempty"` - Gravatar_id string `json:"gravatar_id,omitempty"` - TypeField string `json:"type,omitempty"` - Received_events_url string `json:"received_events_url,omitempty"` - Gists_url string `json:"gists_url,omitempty"` - Repos_url string `json:"repos_url,omitempty"` - Login string `json:"login"` - Name string `json:"name,omitempty"` - Site_admin bool `json:"site_admin,omitempty"` - Avatar_url string `json:"avatar_url,omitempty"` - Followers_url string `json:"followers_url,omitempty"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` // ID of the reviewer which must review changes to matching files. - TypeField string `json:"type"` // The type of the reviewer -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_advisory GeneratedType `json:"repository_advisory"` // A repository security advisory. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Version string `json:"version"` - Change_status map[string]interface{} `json:"change_status"` - Committed_at string `json:"committed_at"` - Url string `json:"url"` - User GeneratedType `json:"user"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Expires_at string `json:"expires_at"` - Name string `json:"name,omitempty"` - Can_certify bool `json:"can_certify"` - Can_sign bool `json:"can_sign"` - Emails []map[string]interface{} `json:"emails"` - Primary_key_id int `json:"primary_key_id"` - Subkeys []map[string]interface{} `json:"subkeys"` - Can_encrypt_storage bool `json:"can_encrypt_storage"` +// GeneratedType_Full_repository represents the GeneratedType_Full_repository schema from the OpenAPI specification +type GeneratedType_Full_repository struct { + Commits_url string `json:"commits_url"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Tags_url string `json:"tags_url"` + Updated_at string `json:"updated_at"` + Fork bool `json:"fork"` + Forks_count int `json:"forks_count"` + Parent Repository `json:"parent,omitempty"` // A repository on GitHub. + Has_discussions bool `json:"has_discussions"` + Svn_url string `json:"svn_url"` + Name string `json:"name"` + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` + Mirror_url string `json:"mirror_url"` + Watchers_count int `json:"watchers_count"` + Watchers int `json:"watchers"` + Trees_url string `json:"trees_url"` + Git_commits_url string `json:"git_commits_url"` + Open_issues_count int `json:"open_issues_count"` + Permissions map[string]interface{} `json:"permissions,omitempty"` Created_at string `json:"created_at"` + Subscription_url string `json:"subscription_url"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Subscribers_count int `json:"subscribers_count"` + Organization GeneratedType_Nullable_simple_user `json:"organization,omitempty"` // A GitHub user. + Has_projects bool `json:"has_projects"` + Language string `json:"language"` + Has_downloads bool `json:"has_downloads,omitempty"` + Stargazers_count int `json:"stargazers_count"` + Teams_url string `json:"teams_url"` + Default_branch string `json:"default_branch"` + Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Full_name string `json:"full_name"` + Assignees_url string `json:"assignees_url"` + Branches_url string `json:"branches_url"` + Comments_url string `json:"comments_url"` + Issue_comment_url string `json:"issue_comment_url"` + Clone_url string `json:"clone_url"` + Source Repository `json:"source,omitempty"` // A repository on GitHub. + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Forks int `json:"forks"` + Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). + Releases_url string `json:"releases_url"` + Git_tags_url string `json:"git_tags_url"` + Node_id string `json:"node_id"` + Html_url string `json:"html_url"` + Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Events_url string `json:"events_url"` + Description string `json:"description"` + Forks_url string `json:"forks_url"` + Topics []string `json:"topics,omitempty"` + Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` + Deployments_url string `json:"deployments_url"` + Archive_url string `json:"archive_url"` + Labels_url string `json:"labels_url"` + Languages_url string `json:"languages_url"` + Downloads_url string `json:"downloads_url"` + Master_branch string `json:"master_branch,omitempty"` + Ssh_url string `json:"ssh_url"` + Git_refs_url string `json:"git_refs_url"` + Network_count int `json:"network_count"` Id int64 `json:"id"` - Revoked bool `json:"revoked"` - Public_key string `json:"public_key"` - Key_id string `json:"key_id"` - Raw_key string `json:"raw_key"` - Can_encrypt_comms bool `json:"can_encrypt_comms"` + Homepage string `json:"homepage"` + Template_repository GeneratedType_Nullable_repository `json:"template_repository,omitempty"` // A repository on GitHub. + Issues_url string `json:"issues_url"` + Code_of_conduct GeneratedType_Code_of_conduct_simple `json:"code_of_conduct,omitempty"` // Code of Conduct Simple + Statuses_url string `json:"statuses_url"` + Compare_url string `json:"compare_url"` + Git_url string `json:"git_url"` + Notifications_url string `json:"notifications_url"` + Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. + Open_issues int `json:"open_issues"` + Collaborators_url string `json:"collaborators_url"` + Blobs_url string `json:"blobs_url"` + Security_and_analysis GeneratedType_Security_and_analysis `json:"security_and_analysis,omitempty"` + Archived bool `json:"archived"` + Issue_events_url string `json:"issue_events_url"` + Has_wiki bool `json:"has_wiki"` + Is_template bool `json:"is_template,omitempty"` + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` + Contributors_url string `json:"contributors_url"` + Private bool `json:"private"` + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` + Allow_forking bool `json:"allow_forking,omitempty"` + Pushed_at string `json:"pushed_at"` + Pulls_url string `json:"pulls_url"` + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Milestones_url string `json:"milestones_url"` + Hooks_url string `json:"hooks_url"` + Has_issues bool `json:"has_issues"` + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. + Contents_url string `json:"contents_url"` + Subscribers_url string `json:"subscribers_url"` + Has_pages bool `json:"has_pages"` + Keys_url string `json:"keys_url"` + Allow_update_branch bool `json:"allow_update_branch,omitempty"` + Stargazers_url string `json:"stargazers_url"` + Url string `json:"url"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` + Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is allowed. + Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. + Merges_url string `json:"merges_url"` + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` } -// Webhooksapprover represents the Webhooksapprover schema from the OpenAPI specification -type Webhooksapprover struct { - Gravatar_id string `json:"gravatar_id,omitempty"` - Received_events_url string `json:"received_events_url,omitempty"` - Url string `json:"url,omitempty"` - Gists_url string `json:"gists_url,omitempty"` - Avatar_url string `json:"avatar_url,omitempty"` - Events_url string `json:"events_url,omitempty"` - Following_url string `json:"following_url,omitempty"` - Site_admin bool `json:"site_admin,omitempty"` - Followers_url string `json:"followers_url,omitempty"` - Repos_url string `json:"repos_url,omitempty"` - Login string `json:"login,omitempty"` - User_view_type string `json:"user_view_type,omitempty"` - Organizations_url string `json:"organizations_url,omitempty"` - Starred_url string `json:"starred_url,omitempty"` - TypeField string `json:"type,omitempty"` - Id int `json:"id,omitempty"` - Subscriptions_url string `json:"subscriptions_url,omitempty"` - Node_id string `json:"node_id,omitempty"` - Html_url string `json:"html_url,omitempty"` +// GeneratedType_Repository_rule_required_status_checks represents the GeneratedType_Repository_rule_required_status_checks schema from the OpenAPI specification +type GeneratedType_Repository_rule_required_status_checks struct { + TypeField string `json:"type"` + Parameters map[string]interface{} `json:"parameters,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_code_scanning_alert_appeared_in_branch represents the GeneratedType_Webhook_code_scanning_alert_appeared_in_branch schema from the OpenAPI specification +type GeneratedType_Webhook_code_scanning_alert_appeared_in_branch struct { Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Starred_at interface{} `json:"starred_at"` // The time the star was created. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Will be `null` for the `deleted` action. +// GeneratedType_Webhook_github_app_authorization_revoked represents the GeneratedType_Webhook_github_app_authorization_revoked schema from the OpenAPI specification +type GeneratedType_Webhook_github_app_authorization_revoked struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Display_name string `json:"display_name"` // Display name for this image. - Id string `json:"id"` // The ID of the image. Use this ID for the `image` parameter when creating a new larger runner. - Platform string `json:"platform"` // The operating system of the image. - Size_gb int `json:"size_gb"` // Image size in GB. - Source string `json:"source"` // The image provider. +// GeneratedType_Community_profile represents the GeneratedType_Community_profile schema from the OpenAPI specification +type GeneratedType_Community_profile struct { + Health_percentage int `json:"health_percentage"` + Updated_at string `json:"updated_at"` + Content_reports_enabled bool `json:"content_reports_enabled,omitempty"` + Description string `json:"description"` + Documentation string `json:"documentation"` + Files map[string]interface{} `json:"files"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // A GitHub repository. - Status string `json:"status,omitempty"` // The attachment status of the code security configuration on the repository. +// GeneratedType_Participation_stats represents the GeneratedType_Participation_stats schema from the OpenAPI specification +type GeneratedType_Participation_stats struct { + All []int `json:"all"` + Owner []int `json:"owner"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_discussion_comment_deleted represents the GeneratedType_Webhook_discussion_comment_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_comment_deleted struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Usageitems []map[string]interface{} `json:"usageItems,omitempty"` + Comment Webhookscomment `json:"comment"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Owned_private_repos int `json:"owned_private_repos,omitempty"` - Avatar_url string `json:"avatar_url"` - Following int `json:"following"` - Collaborators int `json:"collaborators,omitempty"` - Login string `json:"login"` - Description string `json:"description"` - Node_id string `json:"node_id"` - Updated_at string `json:"updated_at"` - Is_verified bool `json:"is_verified,omitempty"` - Id int `json:"id"` - Total_private_repos int `json:"total_private_repos,omitempty"` - Billing_email string `json:"billing_email,omitempty"` - Blog string `json:"blog,omitempty"` - Events_url string `json:"events_url"` - Members_allowed_repository_creation_type string `json:"members_allowed_repository_creation_type,omitempty"` - Twitter_username string `json:"twitter_username,omitempty"` - Plan map[string]interface{} `json:"plan,omitempty"` - Members_can_fork_private_repositories bool `json:"members_can_fork_private_repositories,omitempty"` - Members_can_create_repositories bool `json:"members_can_create_repositories,omitempty"` - Two_factor_requirement_enabled bool `json:"two_factor_requirement_enabled,omitempty"` - Company string `json:"company,omitempty"` - Html_url string `json:"html_url"` - Issues_url string `json:"issues_url"` - Has_repository_projects bool `json:"has_repository_projects"` - Location string `json:"location,omitempty"` - Url string `json:"url"` - Disk_usage int `json:"disk_usage,omitempty"` - Members_can_create_private_pages bool `json:"members_can_create_private_pages,omitempty"` - Public_gists int `json:"public_gists"` - Public_members_url string `json:"public_members_url"` - Followers int `json:"followers"` - Hooks_url string `json:"hooks_url"` - Members_can_create_pages bool `json:"members_can_create_pages,omitempty"` - Created_at string `json:"created_at"` - Members_can_create_public_pages bool `json:"members_can_create_public_pages,omitempty"` - Has_organization_projects bool `json:"has_organization_projects"` - Name string `json:"name,omitempty"` - Members_can_create_public_repositories bool `json:"members_can_create_public_repositories,omitempty"` - Public_repos int `json:"public_repos"` - Default_repository_permission string `json:"default_repository_permission,omitempty"` - Archived_at string `json:"archived_at"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` - Members_can_create_private_repositories bool `json:"members_can_create_private_repositories,omitempty"` - Members_can_create_internal_repositories bool `json:"members_can_create_internal_repositories,omitempty"` - Private_gists int `json:"private_gists,omitempty"` - Repos_url string `json:"repos_url"` - Email string `json:"email,omitempty"` - TypeField string `json:"type"` - Members_url string `json:"members_url"` +// GeneratedType_Webhook_secret_scanning_alert_created represents the GeneratedType_Webhook_secret_scanning_alert_created schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_created struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Alert GeneratedType_Secret_scanning_alert_webhook `json:"alert"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_project_card_deleted represents the GeneratedType_Webhook_project_card_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_project_card_deleted struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_card map[string]interface{} `json:"project_card"` + Repository GeneratedType_Nullable_repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Alert map[string]interface{} `json:"alert"` // The security alert of the vulnerable dependency. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Workflow_run map[string]interface{} `json:"workflow_run"` - Comment string `json:"comment,omitempty"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Since string `json:"since"` - Workflow_job_runs []map[string]interface{} `json:"workflow_job_runs,omitempty"` - Approver Webhooksapprover `json:"approver,omitempty"` - Workflow_job_run Webhooksworkflowjobrun `json:"workflow_job_run,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Webhook_pull_request_assigned represents the GeneratedType_Webhook_pull_request_assigned schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_assigned struct { + Pull_request map[string]interface{} `json:"pull_request"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Reviewers []map[string]interface{} `json:"reviewers,omitempty"` - Sender GeneratedType `json:"sender"` // A GitHub user. + Assignee Webhooksuser `json:"assignee"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Number int `json:"number"` // The pull request number. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Configuration GeneratedType `json:"configuration,omitempty"` // A code security configuration - Status string `json:"status,omitempty"` // The attachment status of the code security configuration on the repository. +// GeneratedType_Projects_v2_single_select_option represents the GeneratedType_Projects_v2_single_select_option schema from the OpenAPI specification +type GeneratedType_Projects_v2_single_select_option struct { + Color string `json:"color,omitempty"` + Description string `json:"description,omitempty"` + Id string `json:"id"` + Name string `json:"name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Milestone Webhooksmilestone3 `json:"milestone"` // A collection of related issues and pull requests. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Runner_label string `json:"runner_label,omitempty"` // The label of the runner to use for code scanning default setup when runner_type is 'labeled'. - Runner_type string `json:"runner_type,omitempty"` // Whether to use labeled runners or standard GitHub runners. +// GeneratedType_Code_scanning_codeql_database represents the GeneratedType_Code_scanning_codeql_database schema from the OpenAPI specification +type GeneratedType_Code_scanning_codeql_database struct { + Name string `json:"name"` // The name of the CodeQL database. + Url string `json:"url"` // The URL at which to download the CodeQL database. The `Accept` header must be set to the value of the `content_type` property. + Commit_oid string `json:"commit_oid,omitempty"` // The commit SHA of the repository at the time the CodeQL database was created. + Language string `json:"language"` // The language of the CodeQL database. + Content_type string `json:"content_type"` // The MIME type of the CodeQL database file. + Created_at string `json:"created_at"` // The date and time at which the CodeQL database was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Id int `json:"id"` // The ID of the CodeQL database. + Size int `json:"size"` // The size of the CodeQL database file in bytes. + Updated_at string `json:"updated_at"` // The date and time at which the CodeQL database was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Uploader GeneratedType_Simple_user `json:"uploader"` // A GitHub user. } -// Collaborator represents the Collaborator schema from the OpenAPI specification -type Collaborator struct { - Url string `json:"url"` - Site_admin bool `json:"site_admin"` - Email string `json:"email,omitempty"` - Role_name string `json:"role_name"` - Followers_url string `json:"followers_url"` - Node_id string `json:"node_id"` - Gists_url string `json:"gists_url"` - Starred_url string `json:"starred_url"` - TypeField string `json:"type"` - Following_url string `json:"following_url"` - Avatar_url string `json:"avatar_url"` - Received_events_url string `json:"received_events_url"` - Gravatar_id string `json:"gravatar_id"` - Organizations_url string `json:"organizations_url"` - Events_url string `json:"events_url"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - User_view_type string `json:"user_view_type,omitempty"` +// GeneratedType_Webhook_rubygems_metadata represents the GeneratedType_Webhook_rubygems_metadata schema from the OpenAPI specification +type GeneratedType_Webhook_rubygems_metadata struct { + Metadata map[string]interface{} `json:"metadata,omitempty"` + Repo string `json:"repo,omitempty"` + Version_info map[string]interface{} `json:"version_info,omitempty"` + Readme string `json:"readme,omitempty"` + Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` - Subscriptions_url string `json:"subscriptions_url"` - Html_url string `json:"html_url"` - Id int64 `json:"id"` - Repos_url string `json:"repos_url"` - Login string `json:"login"` + Platform string `json:"platform,omitempty"` + Commit_oid string `json:"commit_oid,omitempty"` + Homepage string `json:"homepage,omitempty"` + Dependencies []map[string]interface{} `json:"dependencies,omitempty"` } -// Manifest represents the Manifest schema from the OpenAPI specification -type Manifest struct { - Name string `json:"name"` // The name of the manifest. - Resolved map[string]interface{} `json:"resolved,omitempty"` // A collection of resolved package dependencies. - File map[string]interface{} `json:"file,omitempty"` - Metadata Metadata `json:"metadata,omitempty"` // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. +// GeneratedType_Pages_health_check represents the GeneratedType_Pages_health_check schema from the OpenAPI specification +type GeneratedType_Pages_health_check struct { + Alt_domain map[string]interface{} `json:"alt_domain,omitempty"` + Domain map[string]interface{} `json:"domain,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url,omitempty"` // The GitHub URL of the alert resource. - Locations_url string `json:"locations_url,omitempty"` // The REST API URL of the code locations for this alert. - Publicly_leaked bool `json:"publicly_leaked,omitempty"` // Whether the detected secret was publicly leaked. - Push_protection_bypass_request_reviewer_comment string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` // An optional comment when reviewing a push protection bypass. - Multi_repo bool `json:"multi_repo,omitempty"` // Whether the detected secret was found in multiple repositories in the same organization or business. - Secret_type string `json:"secret_type,omitempty"` // The type of secret that secret scanning detected. - Push_protection_bypass_request_reviewer GeneratedType `json:"push_protection_bypass_request_reviewer,omitempty"` // A GitHub user. - Validity string `json:"validity,omitempty"` // The token status as of the latest validity check. - Push_protection_bypass_request_comment string `json:"push_protection_bypass_request_comment,omitempty"` // An optional comment when requesting a push protection bypass. - Resolved_by GeneratedType `json:"resolved_by,omitempty"` // A GitHub user. - Secret_type_display_name string `json:"secret_type_display_name,omitempty"` // User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)." - Push_protection_bypassed_at string `json:"push_protection_bypassed_at,omitempty"` // The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Push_protection_bypass_request_html_url string `json:"push_protection_bypass_request_html_url,omitempty"` // The URL to a push protection bypass request. - Resolved_at string `json:"resolved_at,omitempty"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Number int `json:"number,omitempty"` // The security alert number. - Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Url string `json:"url,omitempty"` // The REST API URL of the alert resource. - Resolution_comment string `json:"resolution_comment,omitempty"` // An optional comment to resolve an alert. - Created_at string `json:"created_at,omitempty"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Push_protection_bypassed bool `json:"push_protection_bypassed,omitempty"` // Whether push protection was bypassed for the detected secret. - Push_protection_bypassed_by GeneratedType `json:"push_protection_bypassed_by,omitempty"` // A GitHub user. - Resolution string `json:"resolution,omitempty"` // The reason for resolving the alert. +// GeneratedType_Referenced_workflow represents the GeneratedType_Referenced_workflow schema from the OpenAPI specification +type GeneratedType_Referenced_workflow struct { + Ref string `json:"ref,omitempty"` + Sha string `json:"sha"` + Path string `json:"path"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Action string `json:"action"` - Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// Migration represents the Migration schema from the OpenAPI specification +type Migration struct { + State string `json:"state"` + Exclude_metadata bool `json:"exclude_metadata"` + Archive_url string `json:"archive_url,omitempty"` + Lock_repositories bool `json:"lock_repositories"` + Url string `json:"url"` + Exclude_git_data bool `json:"exclude_git_data"` + Guid string `json:"guid"` + Id int64 `json:"id"` + Exclude_owner_projects bool `json:"exclude_owner_projects"` + Owner GeneratedType_Nullable_simple_user `json:"owner"` // A GitHub user. + Org_metadata_only bool `json:"org_metadata_only"` + Repositories []Repository `json:"repositories"` // The repositories included in the migration. Only returned for export migrations. + Exclude_attachments bool `json:"exclude_attachments"` + Updated_at string `json:"updated_at"` + Created_at string `json:"created_at"` + Exclude []string `json:"exclude,omitempty"` // Exclude related items from being returned in the response in order to improve performance of the request. The array can include any of: `"repositories"`. + Exclude_releases bool `json:"exclude_releases"` + Node_id string `json:"node_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_column Webhooksprojectcolumn `json:"project_column"` +// GeneratedType_Dependabot_public_key represents the GeneratedType_Dependabot_public_key schema from the OpenAPI specification +type GeneratedType_Dependabot_public_key struct { + Key string `json:"key"` // The Base64 encoded public key. + Key_id string `json:"key_id"` // The identifier for the key. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Login string `json:"login"` - Avatar_url string `json:"avatar_url"` - Html_url string `json:"html_url"` - Id int `json:"id"` +// GeneratedType_Webhook_check_run_rerequested_form_encoded represents the GeneratedType_Webhook_check_run_rerequested_form_encoded schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_rerequested_form_encoded struct { + Payload string `json:"payload"` // A URL-encoded string of the check_run.rerequested JSON payload. The decoded payload is a JSON object. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` // Unique identifier of the team - Ldap_dn string `json:"ldap_dn,omitempty"` // Distinguished Name (DN) that team maps to within LDAP environment +// GeneratedType_Review_request_removed_issue_event represents the GeneratedType_Review_request_removed_issue_event schema from the OpenAPI specification +type GeneratedType_Review_request_removed_issue_event struct { + Requested_reviewer GeneratedType_Simple_user `json:"requested_reviewer,omitempty"` // A GitHub user. + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_url string `json:"commit_url"` + Url string `json:"url"` + Created_at string `json:"created_at"` + Id int `json:"id"` Node_id string `json:"node_id"` - Notification_setting string `json:"notification_setting,omitempty"` // The notification setting the team has set - Permission string `json:"permission"` // Permission that the team will have for its repositories - Url string `json:"url"` // URL for the team - Description string `json:"description"` // Description of the team - Html_url string `json:"html_url"` - Members_url string `json:"members_url"` - Name string `json:"name"` // Name of the team - Privacy string `json:"privacy,omitempty"` // The level of privacy this team should have - Repositories_url string `json:"repositories_url"` - Slug string `json:"slug"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Review_requester GeneratedType_Simple_user `json:"review_requester"` // A GitHub user. + Requested_team Team `json:"requested_team,omitempty"` // Groups of organization members that gives permissions on specified repositories. + Commit_id string `json:"commit_id"` + Event string `json:"event"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Nullable_simple_repository represents the GeneratedType_Nullable_simple_repository schema from the OpenAPI specification +type GeneratedType_Nullable_simple_repository struct { + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Teams_url string `json:"teams_url"` // The API URL to list the teams on the repository. + Keys_url string `json:"keys_url"` // A template for the API URL to get information about deploy keys on the repository. + Id int64 `json:"id"` // A unique identifier of the repository. + Languages_url string `json:"languages_url"` // The API URL to get information about the languages of the repository. + Html_url string `json:"html_url"` // The URL to view the repository on GitHub.com. + Compare_url string `json:"compare_url"` // A template for the API URL to compare two commits or refs. + Releases_url string `json:"releases_url"` // A template for the API URL to get information about releases on the repository. + Fork bool `json:"fork"` // Whether the repository is a fork. + Private bool `json:"private"` // Whether the repository is private. + Full_name string `json:"full_name"` // The full, globally unique, name of the repository. + Description string `json:"description"` // The repository description. + Hooks_url string `json:"hooks_url"` // The API URL to list the hooks on the repository. + Merges_url string `json:"merges_url"` // The API URL to merge branches in the repository. + Issues_url string `json:"issues_url"` // A template for the API URL to get information about issues on the repository. + Events_url string `json:"events_url"` // The API URL to list the events of the repository. + Git_tags_url string `json:"git_tags_url"` // A template for the API URL to get information about Git tags of the repository. + Pulls_url string `json:"pulls_url"` // A template for the API URL to get information about pull requests on the repository. + Commits_url string `json:"commits_url"` // A template for the API URL to get information about commits on the repository. + Contributors_url string `json:"contributors_url"` // A template for the API URL to list the contributors to the repository. + Forks_url string `json:"forks_url"` // The API URL to list the forks of the repository. + Subscription_url string `json:"subscription_url"` // The API URL to subscribe to notifications for this repository. + Url string `json:"url"` // The URL to get more information about the repository from the GitHub API. + Archive_url string `json:"archive_url"` // A template for the API URL to download the repository as an archive. + Subscribers_url string `json:"subscribers_url"` // The API URL to list the subscribers on the repository. + Labels_url string `json:"labels_url"` // A template for the API URL to get information about labels of the repository. + Contents_url string `json:"contents_url"` // A template for the API URL to get the contents of the repository. + Blobs_url string `json:"blobs_url"` // A template for the API URL to create or retrieve a raw Git blob in the repository. + Collaborators_url string `json:"collaborators_url"` // A template for the API URL to get information about collaborators of the repository. + Notifications_url string `json:"notifications_url"` // A template for the API URL to get information about notifications on the repository. + Branches_url string `json:"branches_url"` // A template for the API URL to get information about branches in the repository. + Assignees_url string `json:"assignees_url"` // A template for the API URL to list the available assignees for issues in the repository. + Statuses_url string `json:"statuses_url"` // A template for the API URL to get information about statuses of a commit. + Git_commits_url string `json:"git_commits_url"` // A template for the API URL to get information about Git commits of the repository. + Deployments_url string `json:"deployments_url"` // The API URL to list the deployments of the repository. + Trees_url string `json:"trees_url"` // A template for the API URL to create or retrieve a raw Git tree of the repository. + Comments_url string `json:"comments_url"` // A template for the API URL to get information about comments on the repository. + Stargazers_url string `json:"stargazers_url"` // The API URL to list the stargazers on the repository. + Name string `json:"name"` // The name of the repository. + Node_id string `json:"node_id"` // The GraphQL identifier of the repository. + Git_refs_url string `json:"git_refs_url"` // A template for the API URL to get information about Git refs of the repository. + Issue_comment_url string `json:"issue_comment_url"` // A template for the API URL to get information about issue comments on the repository. + Tags_url string `json:"tags_url"` // The API URL to get information about tags on the repository. + Milestones_url string `json:"milestones_url"` // A template for the API URL to get information about milestones of the repository. + Downloads_url string `json:"downloads_url"` // The API URL to list the downloads on the repository. + Issue_events_url string `json:"issue_events_url"` // A template for the API URL to get information about issue events on the repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Projects_v2 GeneratedType `json:"projects_v2"` // A projects v2 project - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Repository_advisory_create represents the GeneratedType_Repository_advisory_create schema from the OpenAPI specification +type GeneratedType_Repository_advisory_create struct { + Cve_id string `json:"cve_id,omitempty"` // The Common Vulnerabilities and Exposures (CVE) ID. + Description string `json:"description"` // A detailed description of what the advisory impacts. + Cvss_vector_string string `json:"cvss_vector_string,omitempty"` // The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`. + Cwe_ids []string `json:"cwe_ids,omitempty"` // A list of Common Weakness Enumeration (CWE) IDs. + Severity string `json:"severity,omitempty"` // The severity of the advisory. You must choose between setting this field or `cvss_vector_string`. + Start_private_fork bool `json:"start_private_fork,omitempty"` // Whether to create a temporary private fork of the repository to collaborate on a fix. + Summary string `json:"summary"` // A short summary of the advisory. + Vulnerabilities []map[string]interface{} `json:"vulnerabilities"` // A product affected by the vulnerability detailed in a repository security advisory. + Credits []map[string]interface{} `json:"credits,omitempty"` // A list of users receiving credit for their participation in the security advisory. } -// Webhooksanswer represents the Webhooksanswer schema from the OpenAPI specification -type Webhooksanswer struct { - Discussion_id int `json:"discussion_id"` - Child_comment_count int `json:"child_comment_count"` +// GeneratedType_Code_scanning_variant_analysis_repo_task represents the GeneratedType_Code_scanning_variant_analysis_repo_task schema from the OpenAPI specification +type GeneratedType_Code_scanning_variant_analysis_repo_task struct { + Failure_message string `json:"failure_message,omitempty"` // The reason of the failure of this repo task. This is only available if the repository task has failed. + Repository GeneratedType_Simple_repository `json:"repository"` // A GitHub repository. + Result_count int `json:"result_count,omitempty"` // The number of results in the case of a successful analysis. This is only available for successful analyses. + Source_location_prefix string `json:"source_location_prefix,omitempty"` // The source location prefix to use. This is only available for successful analyses. + Analysis_status string `json:"analysis_status"` // The new status of the CodeQL variant analysis repository task. + Artifact_size_in_bytes int `json:"artifact_size_in_bytes,omitempty"` // The size of the artifact. This is only available for successful analyses. + Artifact_url string `json:"artifact_url,omitempty"` // The URL of the artifact. This is only available for successful analyses. + Database_commit_sha string `json:"database_commit_sha,omitempty"` // The SHA of the commit the CodeQL database was built against. This is only available for successful analyses. +} + +// GeneratedType_Content_submodule represents the GeneratedType_Content_submodule schema from the OpenAPI specification +type GeneratedType_Content_submodule struct { + Download_url string `json:"download_url"` Html_url string `json:"html_url"` - Node_id string `json:"node_id"` - Parent_id interface{} `json:"parent_id"` - Updated_at string `json:"updated_at"` - User map[string]interface{} `json:"user"` - Created_at string `json:"created_at"` - Id int `json:"id"` - Reactions map[string]interface{} `json:"reactions,omitempty"` - Repository_url string `json:"repository_url"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Body string `json:"body"` + Name string `json:"name"` + Sha string `json:"sha"` + Submodule_git_url string `json:"submodule_git_url"` + TypeField string `json:"type"` + Url string `json:"url"` + Git_url string `json:"git_url"` + Path string `json:"path"` + Size int `json:"size"` + Links map[string]interface{} `json:"_links"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue Webhooksissue2 `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Oidc_custom_sub_repo represents the GeneratedType_Oidc_custom_sub_repo schema from the OpenAPI specification +type GeneratedType_Oidc_custom_sub_repo struct { + Include_claim_keys []string `json:"include_claim_keys,omitempty"` // Array of unique strings. Each claim key can only contain alphanumeric characters and underscores. + Use_default bool `json:"use_default"` // Whether to use the default template or not. If `true`, the `include_claim_keys` field is ignored. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Repository_advisory GeneratedType `json:"repository_advisory"` // A repository security advisory. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_pull_request_demilestoned represents the GeneratedType_Webhook_pull_request_demilestoned schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_demilestoned struct { + Pull_request Webhookspullrequest5 `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Milestone Milestone `json:"milestone,omitempty"` // A collection of related issues and pull requests. + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Sponsorship Webhookssponsorship `json:"sponsorship"` - Action string `json:"action"` - Changes Webhookschanges8 `json:"changes"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Effective_date string `json:"effective_date,omitempty"` // The `pending_cancellation` and `pending_tier_change` event types will include the date the cancellation or tier change will take effect. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Repository_rule_ruleset_info represents the GeneratedType_Repository_rule_ruleset_info schema from the OpenAPI specification +type GeneratedType_Repository_rule_ruleset_info struct { + Ruleset_source string `json:"ruleset_source,omitempty"` // The name of the source of the ruleset that includes this rule. + Ruleset_source_type string `json:"ruleset_source_type,omitempty"` // The type of source for the ruleset that includes this rule. + Ruleset_id int `json:"ruleset_id,omitempty"` // The ID of the ruleset that includes this rule. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Personal_access_token_request GeneratedType `json:"personal_access_token_request"` // Details of a Personal Access Token Request. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_repository_ruleset_edited represents the GeneratedType_Webhook_repository_ruleset_edited schema from the OpenAPI specification +type GeneratedType_Webhook_repository_ruleset_edited struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Repository_ruleset GeneratedType_Repository_ruleset `json:"repository_ruleset"` // A set of rules to apply when specified conditions are met. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Changes map[string]interface{} `json:"changes,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// Activity represents the Activity schema from the OpenAPI specification -type Activity struct { - Timestamp string `json:"timestamp"` // The time when the activity occurred. - Activity_type string `json:"activity_type"` // The type of the activity that was performed. - Actor GeneratedType `json:"actor"` // A GitHub user. - After string `json:"after"` // The SHA of the commit after the activity. - Before string `json:"before"` // The SHA of the commit before the activity. +// GeneratedType_Review_dismissed_issue_event represents the GeneratedType_Review_dismissed_issue_event schema from the OpenAPI specification +type GeneratedType_Review_dismissed_issue_event struct { Id int `json:"id"` Node_id string `json:"node_id"` - Ref string `json:"ref"` // The full Git reference, formatted as `refs/heads/`. + Event string `json:"event"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Url string `json:"url"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_id string `json:"commit_id"` + Commit_url string `json:"commit_url"` + Dismissed_review map[string]interface{} `json:"dismissed_review"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_deployment_created represents the GeneratedType_Webhook_deployment_created schema from the OpenAPI specification +type GeneratedType_Webhook_deployment_created struct { Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Comment Webhooksreviewcomment `json:"comment"` // The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Changes Webhookschanges `json:"changes"` // The changes to the comment. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow_run map[string]interface{} `json:"workflow_run"` + Deployment map[string]interface{} `json:"deployment"` // The [deployment](https://docs.github.com/rest/deployments/deployments#list-deployments). + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Workflow Webhooksworkflow `json:"workflow"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_projects_v2_item_archived represents the GeneratedType_Webhook_projects_v2_item_archived schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_archived struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Check_suite map[string]interface{} `json:"check_suite"` // The [check_suite](https://docs.github.com/rest/checks/suites#get-a-check-suite). - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. + Changes Webhooksprojectchanges `json:"changes"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Creator GeneratedType `json:"creator"` // A GitHub user. - Private bool `json:"private,omitempty"` // Whether the project is private or not. Only present when owner is an organization. - Organization_permission string `json:"organization_permission,omitempty"` // The organization permission for this project. Only present when owner is an organization. - Html_url string `json:"html_url"` - Permissions map[string]interface{} `json:"permissions"` - Id int `json:"id"` - Name string `json:"name"` - State string `json:"state"` - Body string `json:"body"` +// GeneratedType_Repository_rule_params_code_scanning_tool represents the GeneratedType_Repository_rule_params_code_scanning_tool schema from the OpenAPI specification +type GeneratedType_Repository_rule_params_code_scanning_tool struct { + Tool string `json:"tool"` // The name of a code scanning tool + Alerts_threshold string `json:"alerts_threshold"` // The severity level at which code scanning results that raise alerts block a reference update. For more information on alert severity levels, see "[About code scanning alerts](https://docs.github.com/code-security/code-scanning/managing-code-scanning-alerts/about-code-scanning-alerts#about-alert-severity-and-security-severity-levels)." + Security_alerts_threshold string `json:"security_alerts_threshold"` // The severity level at which code scanning results that raise security alerts block a reference update. For more information on security severity levels, see "[About code scanning alerts](https://docs.github.com/code-security/code-scanning/managing-code-scanning-alerts/about-code-scanning-alerts#about-alert-severity-and-security-severity-levels)." +} + +// GeneratedType_Projects_v2_item represents the GeneratedType_Projects_v2_item schema from the OpenAPI specification +type GeneratedType_Projects_v2_item struct { Updated_at string `json:"updated_at"` + Content_type string `json:"content_type"` // The type of content tracked in a project item + Project_node_id string `json:"project_node_id,omitempty"` + Archived_at string `json:"archived_at"` + Content_node_id string `json:"content_node_id"` Created_at string `json:"created_at"` - Owner_url string `json:"owner_url"` - Columns_url string `json:"columns_url"` - Node_id string `json:"node_id"` - Url string `json:"url"` - Number int `json:"number"` + Node_id string `json:"node_id,omitempty"` + Creator GeneratedType_Simple_user `json:"creator,omitempty"` // A GitHub user. + Id float64 `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Topics []string `json:"topics,omitempty"` - Role_name string `json:"role_name,omitempty"` - Html_url string `json:"html_url"` - Trees_url string `json:"trees_url"` - Git_refs_url string `json:"git_refs_url"` - Mirror_url string `json:"mirror_url,omitempty"` - Open_issues int `json:"open_issues,omitempty"` - Branches_url string `json:"branches_url"` - Is_template bool `json:"is_template,omitempty"` - Default_branch string `json:"default_branch,omitempty"` - Owner GeneratedType `json:"owner"` // A GitHub user. - Subscribers_count int `json:"subscribers_count,omitempty"` - Assignees_url string `json:"assignees_url"` - Archive_url string `json:"archive_url"` - Pulls_url string `json:"pulls_url"` - Tags_url string `json:"tags_url"` - License map[string]interface{} `json:"license,omitempty"` - Deployments_url string `json:"deployments_url"` +// GeneratedType_Secret_scanning_location_wiki_commit represents the GeneratedType_Secret_scanning_location_wiki_commit schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_wiki_commit struct { + Blob_sha string `json:"blob_sha"` // SHA-1 hash ID of the associated blob + Commit_sha string `json:"commit_sha"` // SHA-1 hash ID of the associated commit + End_column float64 `json:"end_column"` // The column at which the secret ends within the end line when the file is interpreted as 8-bit ASCII. + Page_url string `json:"page_url"` // The GitHub URL to get the associated wiki page + Start_line float64 `json:"start_line"` // Line number at which the secret starts in the file + Commit_url string `json:"commit_url"` // The GitHub URL to get the associated wiki commit + End_line float64 `json:"end_line"` // Line number at which the secret ends in the file + Path string `json:"path"` // The file path of the wiki page + Start_column float64 `json:"start_column"` // The column at which the secret starts within the start line when the file is interpreted as 8-bit ASCII. +} + +// GeneratedType_Nullable_milestone represents the GeneratedType_Nullable_milestone schema from the OpenAPI specification +type GeneratedType_Nullable_milestone struct { + Created_at string `json:"created_at"` + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. Labels_url string `json:"labels_url"` - Pushed_at string `json:"pushed_at,omitempty"` - Size int `json:"size,omitempty"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Contents_url string `json:"contents_url"` - Collaborators_url string `json:"collaborators_url"` + Updated_at string `json:"updated_at"` + Id int `json:"id"` + State string `json:"state"` // The state of the milestone. + Closed_issues int `json:"closed_issues"` + Due_on string `json:"due_on"` Description string `json:"description"` - Contributors_url string `json:"contributors_url"` - Downloads_url string `json:"downloads_url"` - Forks_count int `json:"forks_count,omitempty"` - Has_projects bool `json:"has_projects,omitempty"` - Watchers int `json:"watchers,omitempty"` - Teams_url string `json:"teams_url"` - Code_of_conduct GeneratedType `json:"code_of_conduct,omitempty"` // Code Of Conduct - Commits_url string `json:"commits_url"` - Stargazers_url string `json:"stargazers_url"` - Security_and_analysis GeneratedType `json:"security_and_analysis,omitempty"` - Hooks_url string `json:"hooks_url"` - Statuses_url string `json:"statuses_url"` - Git_commits_url string `json:"git_commits_url"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` - Disabled bool `json:"disabled,omitempty"` - Notifications_url string `json:"notifications_url"` - Updated_at string `json:"updated_at,omitempty"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Compare_url string `json:"compare_url"` - Has_pages bool `json:"has_pages,omitempty"` - Keys_url string `json:"keys_url"` - Created_at string `json:"created_at,omitempty"` - Events_url string `json:"events_url"` - Issues_url string `json:"issues_url"` - Clone_url string `json:"clone_url,omitempty"` - Git_url string `json:"git_url,omitempty"` - Releases_url string `json:"releases_url"` - Has_wiki bool `json:"has_wiki,omitempty"` - Languages_url string `json:"languages_url"` - Visibility string `json:"visibility,omitempty"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Private bool `json:"private"` - Subscription_url string `json:"subscription_url"` + Title string `json:"title"` // The title of the milestone. + Open_issues int `json:"open_issues"` + Number int `json:"number"` // The number of the milestone. Url string `json:"url"` - Homepage string `json:"homepage,omitempty"` - Svn_url string `json:"svn_url,omitempty"` - Archived bool `json:"archived,omitempty"` - Issue_events_url string `json:"issue_events_url"` - Allow_forking bool `json:"allow_forking,omitempty"` - Has_downloads bool `json:"has_downloads,omitempty"` - Full_name string `json:"full_name"` - Merges_url string `json:"merges_url"` - Fork bool `json:"fork"` - Comments_url string `json:"comments_url"` - Ssh_url string `json:"ssh_url,omitempty"` - Id int64 `json:"id"` - Name string `json:"name"` - Network_count int `json:"network_count,omitempty"` - Blobs_url string `json:"blobs_url"` - Forks_url string `json:"forks_url"` - Issue_comment_url string `json:"issue_comment_url"` Node_id string `json:"node_id"` - Has_discussions bool `json:"has_discussions,omitempty"` - Language string `json:"language,omitempty"` - Stargazers_count int `json:"stargazers_count,omitempty"` - Watchers_count int `json:"watchers_count,omitempty"` - Git_tags_url string `json:"git_tags_url"` - Forks int `json:"forks,omitempty"` - Subscribers_url string `json:"subscribers_url"` - Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. - Milestones_url string `json:"milestones_url"` - Has_issues bool `json:"has_issues,omitempty"` - Open_issues_count int `json:"open_issues_count,omitempty"` + Closed_at string `json:"closed_at"` + Html_url string `json:"html_url"` } -// Webhooksreviewcomment represents the Webhooksreviewcomment schema from the OpenAPI specification -type Webhooksreviewcomment struct { - Created_at string `json:"created_at"` - Line int `json:"line"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment - Original_line int `json:"original_line"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment - Side string `json:"side"` // The side of the first line of the range for a multi-line comment. - Path string `json:"path"` // The relative path of the file to which the comment applies. - Start_side string `json:"start_side"` // The side of the first line of the range for a multi-line comment. - Html_url string `json:"html_url"` // HTML URL for the pull request review comment. - Original_commit_id string `json:"original_commit_id"` // The SHA of the original commit to which the comment applies. - User map[string]interface{} `json:"user"` - Diff_hunk string `json:"diff_hunk"` // The diff of the line that the comment refers to. - Subject_type string `json:"subject_type,omitempty"` // The level at which the comment is targeted, can be a diff line or a file. - Updated_at string `json:"updated_at"` - Commit_id string `json:"commit_id"` // The SHA of the commit to which the comment applies. - Id int `json:"id"` // The ID of the pull request review comment. - Node_id string `json:"node_id"` // The node ID of the pull request review comment. - Pull_request_url string `json:"pull_request_url"` // URL for the pull request that the review comment belongs to. - In_reply_to_id int `json:"in_reply_to_id,omitempty"` // The comment ID to reply to. - Pull_request_review_id int `json:"pull_request_review_id"` // The ID of the pull request review to which the comment belongs. - Url string `json:"url"` // URL for the pull request review comment - Links map[string]interface{} `json:"_links"` - Original_start_line int `json:"original_start_line"` // The first line of the range for a multi-line comment. - Reactions map[string]interface{} `json:"reactions"` - Start_line int `json:"start_line"` // The first line of the range for a multi-line comment. - Original_position int `json:"original_position"` // The index of the original line in the diff to which the comment applies. - Body string `json:"body"` // The text of the comment. - Position int `json:"position"` // The line index in the diff to which the comment applies. - Author_association string `json:"author_association"` // How the author is associated with the repository. +// GeneratedType_Webhook_team_created represents the GeneratedType_Webhook_team_created schema from the OpenAPI specification +type GeneratedType_Webhook_team_created struct { + Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository map[string]interface{} `json:"repository,omitempty"` // A git repository + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action,omitempty"` - Check_run GeneratedType `json:"check_run"` // A check performed on the code of a given code change +// GeneratedType_Hook_response represents the GeneratedType_Hook_response schema from the OpenAPI specification +type GeneratedType_Hook_response struct { + Status string `json:"status"` + Code int `json:"code"` + Message string `json:"message"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action,omitempty"` - Alert GeneratedType `json:"alert"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Location GeneratedType `json:"location"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// Manifest represents the Manifest schema from the OpenAPI specification +type Manifest struct { + File map[string]interface{} `json:"file,omitempty"` + Metadata Metadata `json:"metadata,omitempty"` // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. + Name string `json:"name"` // The name of the manifest. + Resolved map[string]interface{} `json:"resolved,omitempty"` // A collection of resolved package dependencies. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation Installation `json:"installation"` // Installation - Repositories_removed []map[string]interface{} `json:"repositories_removed"` // An array of repository objects, which were removed from the installation. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved - Requester Webhooksuser `json:"requester"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories_added []map[string]interface{} `json:"repositories_added"` // An array of repository objects, which were added to the installation. - Action string `json:"action"` +// GeneratedType_Link_with_type represents the GeneratedType_Link_with_type schema from the OpenAPI specification +type GeneratedType_Link_with_type struct { + Href string `json:"href"` + TypeField string `json:"type"` } -// Webhooksproject represents the Webhooksproject schema from the OpenAPI specification -type Webhooksproject struct { +// Package represents the Package schema from the OpenAPI specification +type Package struct { + Created_at string `json:"created_at"` + Package_type string `json:"package_type"` Html_url string `json:"html_url"` - Node_id string `json:"node_id"` + Repository GeneratedType_Nullable_minimal_repository `json:"repository,omitempty"` // Minimal Repository + Id int `json:"id"` // Unique identifier of the package. + Name string `json:"name"` // The name of the package. + Owner GeneratedType_Nullable_simple_user `json:"owner,omitempty"` // A GitHub user. + Version_count int `json:"version_count"` // The number of versions of the package. + Visibility string `json:"visibility"` Updated_at string `json:"updated_at"` - Body string `json:"body"` // Body of the project - Created_at string `json:"created_at"` - Owner_url string `json:"owner_url"` - Creator map[string]interface{} `json:"creator"` Url string `json:"url"` - Columns_url string `json:"columns_url"` - Id int `json:"id"` - Name string `json:"name"` // Name of the project - Number int `json:"number"` - State string `json:"state"` // State of the project; either 'open' or 'closed' } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Subscriptions_url string `json:"subscriptions_url"` - Twitter_username string `json:"twitter_username,omitempty"` - Followers_url string `json:"followers_url"` - Node_id string `json:"node_id"` - User_view_type string `json:"user_view_type,omitempty"` - Bio string `json:"bio"` - Followers int `json:"followers"` - Name string `json:"name"` - Location string `json:"location"` - Avatar_url string `json:"avatar_url"` - Received_events_url string `json:"received_events_url"` - Public_gists int `json:"public_gists"` - Created_at string `json:"created_at"` - Site_admin bool `json:"site_admin"` - Total_private_repos int `json:"total_private_repos,omitempty"` - Following_url string `json:"following_url"` - Gists_url string `json:"gists_url"` - Hireable bool `json:"hireable"` - Starred_url string `json:"starred_url"` - Collaborators int `json:"collaborators,omitempty"` - Notification_email string `json:"notification_email,omitempty"` - Email string `json:"email"` - Repos_url string `json:"repos_url"` - Owned_private_repos int `json:"owned_private_repos,omitempty"` - Updated_at string `json:"updated_at"` - Login string `json:"login"` - Private_gists int `json:"private_gists,omitempty"` - Disk_usage int `json:"disk_usage,omitempty"` - Public_repos int `json:"public_repos"` - Blog string `json:"blog"` - Organizations_url string `json:"organizations_url"` - Plan map[string]interface{} `json:"plan,omitempty"` - Events_url string `json:"events_url"` - Gravatar_id string `json:"gravatar_id"` - Html_url string `json:"html_url"` - Id int64 `json:"id"` - Url string `json:"url"` - Company string `json:"company"` - TypeField string `json:"type"` - Following int `json:"following"` +// GeneratedType_Webhook_issues_unlabeled represents the GeneratedType_Webhook_issues_unlabeled schema from the OpenAPI specification +type GeneratedType_Webhook_issues_unlabeled struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Label Webhookslabel `json:"label,omitempty"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Context string `json:"context"` // The status check context name that must be present on the commit. - Integration_id int `json:"integration_id,omitempty"` // The optional integration ID that this status check must originate from. +// GeneratedType_Code_scanning_default_setup_options represents the GeneratedType_Code_scanning_default_setup_options schema from the OpenAPI specification +type GeneratedType_Code_scanning_default_setup_options struct { + Runner_type string `json:"runner_type,omitempty"` // Whether to use labeled runners or standard GitHub runners. + Runner_label string `json:"runner_label,omitempty"` // The label of the runner to use for code scanning default setup when runner_type is 'labeled'. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Token_id int `json:"token_id"` // Unique identifier of the user's token. This field can also be found in audit log events and the organization's settings for their PAT grants. - Token_last_used_at string `json:"token_last_used_at"` // Date and time when the associated fine-grained personal access token was last used for authentication. - Token_expires_at string `json:"token_expires_at"` // Date and time when the associated fine-grained personal access token expires. - Owner GeneratedType `json:"owner"` // A GitHub user. - Permissions_added map[string]interface{} `json:"permissions_added"` // New requested permissions, categorized by type of permission. - Permissions_result map[string]interface{} `json:"permissions_result"` // Permissions requested, categorized by type of permission. This field incorporates `permissions_added` and `permissions_upgraded`. - Permissions_upgraded map[string]interface{} `json:"permissions_upgraded"` // Requested permissions that elevate access for a previously approved request for access, categorized by type of permission. - Repositories []map[string]interface{} `json:"repositories"` // An array of repository objects the token is requesting access to. This field is only populated when `repository_selection` is `subset`. - Repository_selection string `json:"repository_selection"` // Type of repository selection requested. - Token_name string `json:"token_name"` // The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. - Created_at string `json:"created_at"` // Date and time when the request for access was created. - Id int `json:"id"` // Unique identifier of the request for access via fine-grained personal access token. Used as the `pat_request_id` parameter in the list and review API calls. - Repository_count int `json:"repository_count"` // The number of repositories the token is requesting access to. This field is only populated when `repository_selection` is `subset`. - Token_expired bool `json:"token_expired"` // Whether the associated fine-grained personal access token has expired. +// GeneratedType_Webhook_release_published represents the GeneratedType_Webhook_release_published schema from the OpenAPI specification +type GeneratedType_Webhook_release_published struct { + Release Webhooksrelease1 `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// Reaction represents the Reaction schema from the OpenAPI specification -type Reaction struct { - User GeneratedType `json:"user"` // A GitHub user. - Content string `json:"content"` // The reaction to use - Created_at string `json:"created_at"` - Id int `json:"id"` +// GeneratedType_Minimal_repository represents the GeneratedType_Minimal_repository schema from the OpenAPI specification +type GeneratedType_Minimal_repository struct { + Allow_forking bool `json:"allow_forking,omitempty"` + Forks int `json:"forks,omitempty"` + Has_pages bool `json:"has_pages,omitempty"` + Size int `json:"size,omitempty"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. + Url string `json:"url"` + Has_downloads bool `json:"has_downloads,omitempty"` + Created_at string `json:"created_at,omitempty"` + Downloads_url string `json:"downloads_url"` + Watchers_count int `json:"watchers_count,omitempty"` + Compare_url string `json:"compare_url"` + Milestones_url string `json:"milestones_url"` + Has_issues bool `json:"has_issues,omitempty"` + Git_url string `json:"git_url,omitempty"` + Labels_url string `json:"labels_url"` + Notifications_url string `json:"notifications_url"` + Hooks_url string `json:"hooks_url"` + Contents_url string `json:"contents_url"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Network_count int `json:"network_count,omitempty"` + Languages_url string `json:"languages_url"` + Pulls_url string `json:"pulls_url"` + Commits_url string `json:"commits_url"` + Has_wiki bool `json:"has_wiki,omitempty"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Role_name string `json:"role_name,omitempty"` + Contributors_url string `json:"contributors_url"` + Mirror_url string `json:"mirror_url,omitempty"` + Archive_url string `json:"archive_url"` + Keys_url string `json:"keys_url"` + Trees_url string `json:"trees_url"` + Pushed_at string `json:"pushed_at,omitempty"` + Merges_url string `json:"merges_url"` + Blobs_url string `json:"blobs_url"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Default_branch string `json:"default_branch,omitempty"` + Git_commits_url string `json:"git_commits_url"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Forks_count int `json:"forks_count,omitempty"` + Has_projects bool `json:"has_projects,omitempty"` + Issues_url string `json:"issues_url"` Node_id string `json:"node_id"` + Subscribers_url string `json:"subscribers_url"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` + Assignees_url string `json:"assignees_url"` + Language string `json:"language,omitempty"` + Id int64 `json:"id"` + Stargazers_url string `json:"stargazers_url"` + Statuses_url string `json:"statuses_url"` + Private bool `json:"private"` + Deployments_url string `json:"deployments_url"` + Stargazers_count int `json:"stargazers_count,omitempty"` + Forks_url string `json:"forks_url"` + Html_url string `json:"html_url"` + Name string `json:"name"` + Tags_url string `json:"tags_url"` + Has_discussions bool `json:"has_discussions,omitempty"` + Subscribers_count int `json:"subscribers_count,omitempty"` + Comments_url string `json:"comments_url"` + Fork bool `json:"fork"` + Teams_url string `json:"teams_url"` + Security_and_analysis GeneratedType_Security_and_analysis `json:"security_and_analysis,omitempty"` + Svn_url string `json:"svn_url,omitempty"` + Git_tags_url string `json:"git_tags_url"` + Topics []string `json:"topics,omitempty"` + Releases_url string `json:"releases_url"` + Open_issues_count int `json:"open_issues_count,omitempty"` + Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. + License map[string]interface{} `json:"license,omitempty"` + Branches_url string `json:"branches_url"` + Code_of_conduct GeneratedType_Code_of_conduct `json:"code_of_conduct,omitempty"` // Code Of Conduct + Ssh_url string `json:"ssh_url,omitempty"` + Disabled bool `json:"disabled,omitempty"` + Issue_comment_url string `json:"issue_comment_url"` + Collaborators_url string `json:"collaborators_url"` + Events_url string `json:"events_url"` + Issue_events_url string `json:"issue_events_url"` + Is_template bool `json:"is_template,omitempty"` + Homepage string `json:"homepage,omitempty"` + Watchers int `json:"watchers,omitempty"` + Description string `json:"description"` + Git_refs_url string `json:"git_refs_url"` + Open_issues int `json:"open_issues,omitempty"` + Archived bool `json:"archived,omitempty"` + Updated_at string `json:"updated_at,omitempty"` + Clone_url string `json:"clone_url,omitempty"` + Full_name string `json:"full_name"` + Subscription_url string `json:"subscription_url"` + Visibility string `json:"visibility,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - In_reply_to_id int `json:"in_reply_to_id,omitempty"` // The comment ID to reply to. - Original_line int `json:"original_line,omitempty"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment - Commit_id string `json:"commit_id"` // The SHA of the commit to which the comment applies. - Author_association string `json:"author_association"` // How the author is associated with the repository. - Url string `json:"url"` // URL for the pull request review comment - Subject_type string `json:"subject_type,omitempty"` // The level at which the comment is targeted, can be a diff line or a file. - User GeneratedType `json:"user"` // A GitHub user. - Path string `json:"path"` // The relative path of the file to which the comment applies. - Created_at string `json:"created_at"` - Original_commit_id string `json:"original_commit_id"` // The SHA of the original commit to which the comment applies. - Body_text string `json:"body_text,omitempty"` - Html_url string `json:"html_url"` // HTML URL for the pull request review comment. - Id int64 `json:"id"` // The ID of the pull request review comment. - Side string `json:"side,omitempty"` // The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment - Start_side string `json:"start_side,omitempty"` // The side of the first line of the range for a multi-line comment. - Original_start_line int `json:"original_start_line,omitempty"` // The first line of the range for a multi-line comment. - Original_position int `json:"original_position,omitempty"` // The index of the original line in the diff to which the comment applies. This field is closing down; use `original_line` instead. - Pull_request_review_id int64 `json:"pull_request_review_id"` // The ID of the pull request review to which the comment belongs. - Links map[string]interface{} `json:"_links"` - Node_id string `json:"node_id"` // The node ID of the pull request review comment. - Updated_at string `json:"updated_at"` - Reactions GeneratedType `json:"reactions,omitempty"` - Pull_request_url string `json:"pull_request_url"` // URL for the pull request that the review comment belongs to. - Line int `json:"line,omitempty"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment - Body string `json:"body"` // The text of the comment. - Position int `json:"position,omitempty"` // The line index in the diff to which the comment applies. This field is closing down; use `line` instead. - Diff_hunk string `json:"diff_hunk"` // The diff of the line that the comment refers to. - Body_html string `json:"body_html,omitempty"` - Start_line int `json:"start_line,omitempty"` // The first line of the range for a multi-line comment. +// GeneratedType_Simple_classroom_repository represents the GeneratedType_Simple_classroom_repository schema from the OpenAPI specification +type GeneratedType_Simple_classroom_repository struct { + Private bool `json:"private"` // Whether the repository is private. + Default_branch string `json:"default_branch"` // The default branch for the repository. + Full_name string `json:"full_name"` // The full, globally unique name of the repository. + Html_url string `json:"html_url"` // The URL to view the repository on GitHub.com. + Id int `json:"id"` // A unique identifier of the repository. + Node_id string `json:"node_id"` // The GraphQL identifier of the repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_personal_access_token_request_denied represents the GeneratedType_Webhook_personal_access_token_request_denied schema from the OpenAPI specification +type GeneratedType_Webhook_personal_access_token_request_denied struct { Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Release map[string]interface{} `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Personal_access_token_request GeneratedType_Personal_access_token_request `json:"personal_access_token_request"` // Details of a Personal Access Token Request. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Member Webhooksuser `json:"member"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Environment_approvals represents the GeneratedType_Environment_approvals schema from the OpenAPI specification +type GeneratedType_Environment_approvals struct { + Environments []map[string]interface{} `json:"environments"` // The list of environments that were approved or rejected + State string `json:"state"` // Whether deployment to the environment(s) was approved or rejected or pending (with comments) + User GeneratedType_Simple_user `json:"user"` // A GitHub user. + Comment string `json:"comment"` // The comment submitted with the deployment review } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Membership Webhooksmembership `json:"membership"` // The membership between the user and the organization. Not present when the action is `member_invited`. - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Scim_error represents the GeneratedType_Scim_error schema from the OpenAPI specification +type GeneratedType_Scim_error struct { + Documentation_url string `json:"documentation_url,omitempty"` + Message string `json:"message,omitempty"` + Schemas []string `json:"schemas,omitempty"` + Scimtype string `json:"scimType,omitempty"` + Status int `json:"status,omitempty"` + Detail string `json:"detail,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Copilot_seat_details represents the GeneratedType_Copilot_seat_details schema from the OpenAPI specification +type GeneratedType_Copilot_seat_details struct { + Assigning_team interface{} `json:"assigning_team,omitempty"` // The team through which the assignee is granted access to GitHub Copilot, if applicable. + Last_activity_at string `json:"last_activity_at,omitempty"` // Timestamp of user's last GitHub Copilot activity, in ISO 8601 format. + Last_activity_editor string `json:"last_activity_editor,omitempty"` // Last editor that was used by the user for a GitHub Copilot completion. + Pending_cancellation_date string `json:"pending_cancellation_date,omitempty"` // The pending cancellation date for the seat, in `YYYY-MM-DD` format. This will be null unless the assignee's Copilot access has been canceled during the current billing cycle. If the seat has been cancelled, this corresponds to the start of the organization's next billing cycle. + Updated_at string `json:"updated_at,omitempty"` // **Closing down notice:** This field is no longer relevant and is closing down. Use the `created_at` field to determine when the assignee was last granted access to GitHub Copilot. Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format. + Assignee GeneratedType_Nullable_simple_user `json:"assignee,omitempty"` // A GitHub user. + Created_at string `json:"created_at"` // Timestamp of when the assignee was last granted access to GitHub Copilot, in ISO 8601 format. + Organization GeneratedType_Nullable_organization_simple `json:"organization,omitempty"` // A GitHub organization. + Plan_type string `json:"plan_type,omitempty"` // The Copilot plan of the organization, or the parent enterprise, when applicable. } -// Workflow represents the Workflow schema from the OpenAPI specification -type Workflow struct { - Deleted_at string `json:"deleted_at,omitempty"` - Id int `json:"id"` - Name string `json:"name"` - Node_id string `json:"node_id"` - Badge_url string `json:"badge_url"` - Updated_at string `json:"updated_at"` - Url string `json:"url"` - State string `json:"state"` - Created_at string `json:"created_at"` - Html_url string `json:"html_url"` - Path string `json:"path"` +// GeneratedType_Webhook_discussion_unlabeled represents the GeneratedType_Webhook_discussion_unlabeled schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_unlabeled struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Label Webhookslabel `json:"label"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Output map[string]interface{} `json:"output"` +// GeneratedType_Converted_note_to_issue_issue_event represents the GeneratedType_Converted_note_to_issue_issue_event schema from the OpenAPI specification +type GeneratedType_Converted_note_to_issue_issue_event struct { Node_id string `json:"node_id"` - Conclusion string `json:"conclusion"` - App Integration `json:"app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Project_card map[string]interface{} `json:"project_card,omitempty"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Event string `json:"event"` Url string `json:"url"` - Deployment GeneratedType `json:"deployment,omitempty"` // A deployment created as the result of an Actions check run from a workflow that references an environment - Status string `json:"status"` // The phase of the lifecycle that the check is currently in. - Head_sha string `json:"head_sha"` // The SHA of the commit that is being checked. - External_id string `json:"external_id"` - Details_url string `json:"details_url"` - Check_suite GeneratedType `json:"check_suite"` // A suite of checks performed on the code of a given code change - Completed_at string `json:"completed_at"` - Html_url string `json:"html_url"` - Started_at string `json:"started_at"` - Id int `json:"id"` // The id of the check. - Pull_requests []GeneratedType `json:"pull_requests"` - Name string `json:"name"` // The name of the check. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` + Commit_id string `json:"commit_id"` + Created_at string `json:"created_at"` + Id int `json:"id"` + Performed_via_github_app Integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Commit_url string `json:"commit_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Accepted bool `json:"accepted"` // Whether the user has accepted the permissions defined by the devcontainer config +// GeneratedType_Actions_hosted_runner represents the GeneratedType_Actions_hosted_runner schema from the OpenAPI specification +type GeneratedType_Actions_hosted_runner struct { + Image_details GeneratedType_Nullable_actions_hosted_runner_pool_image `json:"image_details"` // Provides details of a hosted runner image + Platform string `json:"platform"` // The operating system of the image. + Id int `json:"id"` // The unique identifier of the hosted runner. + Last_active_on string `json:"last_active_on,omitempty"` // The time at which the runner was last used, in ISO 8601 format. + Machine_size_details GeneratedType_Actions_hosted_runner_machine_spec `json:"machine_size_details"` // Provides details of a particular machine spec. + Public_ips []GeneratedType_Public_ip `json:"public_ips,omitempty"` // The public IP ranges when public IP is enabled for the hosted runners. + Runner_group_id int `json:"runner_group_id,omitempty"` // The unique identifier of the group that the hosted runner belongs to. + Status string `json:"status"` // The status of the runner. + Public_ip_enabled bool `json:"public_ip_enabled"` // Whether public IP is enabled for the hosted runners. + Maximum_runners int `json:"maximum_runners,omitempty"` // The maximum amount of hosted runners. Runners will not scale automatically above this number. Use this setting to limit your cost. + Name string `json:"name"` // The name of the hosted runner. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_pull_request_closed represents the GeneratedType_Webhook_pull_request_closed schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_closed struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request GeneratedType_Pull_request_webhook `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Workflow_run map[string]interface{} `json:"workflow_run"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Deployment map[string]interface{} `json:"deployment"` // The [deployment](https://docs.github.com/rest/deployments/deployments#list-deployments). - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow Webhooksworkflow `json:"workflow"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` // The pull request number. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` - Parameters map[string]interface{} `json:"parameters,omitempty"` +// GeneratedType_Webhook_project_card_edited represents the GeneratedType_Webhook_project_card_edited schema from the OpenAPI specification +type GeneratedType_Webhook_project_card_edited struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_card Webhooksprojectcard `json:"project_card"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Runs_rerequestable bool `json:"runs_rerequestable,omitempty"` - After string `json:"after"` - Head_branch string `json:"head_branch"` - Id int64 `json:"id"` - Node_id string `json:"node_id"` - Created_at string `json:"created_at"` - Url string `json:"url"` - App GeneratedType `json:"app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Conclusion string `json:"conclusion"` - Status string `json:"status"` // The phase of the lifecycle that the check suite is currently in. Statuses of waiting, requested, and pending are reserved for GitHub Actions check suites. - Before string `json:"before"` - Check_runs_url string `json:"check_runs_url"` - Repository GeneratedType `json:"repository"` // Minimal Repository - Updated_at string `json:"updated_at"` - Pull_requests []GeneratedType `json:"pull_requests"` - Latest_check_runs_count int `json:"latest_check_runs_count"` - Rerequestable bool `json:"rerequestable,omitempty"` - Head_commit GeneratedType `json:"head_commit"` // A commit. - Head_sha string `json:"head_sha"` // The SHA of the head commit that is being checked. +// GeneratedType_Webhook_repository_privatized represents the GeneratedType_Webhook_repository_privatized schema from the OpenAPI specification +type GeneratedType_Webhook_repository_privatized struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// Webhooksmilestone3 represents the Webhooksmilestone3 schema from the OpenAPI specification -type Webhooksmilestone3 struct { - Creator map[string]interface{} `json:"creator"` - Id int `json:"id"` - Url string `json:"url"` - Due_on string `json:"due_on"` - Open_issues int `json:"open_issues"` - Node_id string `json:"node_id"` - Closed_issues int `json:"closed_issues"` - Labels_url string `json:"labels_url"` - Number int `json:"number"` // The number of the milestone. - Created_at string `json:"created_at"` - Html_url string `json:"html_url"` - State string `json:"state"` // The state of the milestone. - Closed_at string `json:"closed_at"` - Description string `json:"description"` - Updated_at string `json:"updated_at"` - Title string `json:"title"` // The title of the milestone. +// GeneratedType_Webhook_repository_archived represents the GeneratedType_Webhook_repository_archived schema from the OpenAPI specification +type GeneratedType_Webhook_repository_archived struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. +// GeneratedType_Webhook_workflow_run_in_progress represents the GeneratedType_Webhook_workflow_run_in_progress schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_run_in_progress struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow Webhooksworkflow `json:"workflow"` + Workflow_run map[string]interface{} `json:"workflow_run"` Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url,omitempty"` - Key string `json:"key"` - Name string `json:"name"` +// GeneratedType_Timeline_assigned_issue_event represents the GeneratedType_Timeline_assigned_issue_event schema from the OpenAPI specification +type GeneratedType_Timeline_assigned_issue_event struct { + Event string `json:"event"` Node_id string `json:"node_id"` - Spdx_id string `json:"spdx_id"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. Url string `json:"url"` + Commit_id string `json:"commit_id"` + Id int `json:"id"` + Assignee GeneratedType_Simple_user `json:"assignee"` // A GitHub user. + Commit_url string `json:"commit_url"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Label Webhookslabel `json:"label"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Code_scanning_sarifs_receipt represents the GeneratedType_Code_scanning_sarifs_receipt schema from the OpenAPI specification +type GeneratedType_Code_scanning_sarifs_receipt struct { + Id string `json:"id,omitempty"` // An identifier for the upload. + Url string `json:"url,omitempty"` // The REST API URL for checking the status of the upload. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_id string `json:"commit_id"` - Created_at string `json:"created_at"` - Event string `json:"event"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Project_card map[string]interface{} `json:"project_card,omitempty"` - Id int `json:"id"` - Commit_url string `json:"commit_url"` - Node_id string `json:"node_id"` - Url string `json:"url"` - Actor GeneratedType `json:"actor"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Duration float64 `json:"duration,omitempty"` - Id string `json:"id"` - Start_date string `json:"start_date,omitempty"` - Title string `json:"title"` +// GeneratedType_User_marketplace_purchase represents the GeneratedType_User_marketplace_purchase schema from the OpenAPI specification +type GeneratedType_User_marketplace_purchase struct { + Next_billing_date string `json:"next_billing_date"` + On_free_trial bool `json:"on_free_trial"` + Plan GeneratedType_Marketplace_listing_plan `json:"plan"` // Marketplace Listing Plan + Unit_count int `json:"unit_count"` + Updated_at string `json:"updated_at"` + Account GeneratedType_Marketplace_account `json:"account"` + Billing_cycle string `json:"billing_cycle"` + Free_trial_ends_on string `json:"free_trial_ends_on"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Download_url string `json:"download_url"` - Html_url string `json:"html_url"` - Size int `json:"size"` +// GeneratedType_Commit_comment represents the GeneratedType_Commit_comment schema from the OpenAPI specification +type GeneratedType_Commit_comment struct { + Id int `json:"id"` + Position int `json:"position"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` Url string `json:"url"` + Commit_id string `json:"commit_id"` + Line int `json:"line"` + Updated_at string `json:"updated_at"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Html_url string `json:"html_url"` Path string `json:"path"` - Sha string `json:"sha"` - Submodule_git_url string `json:"submodule_git_url,omitempty"` - Target string `json:"target,omitempty"` - TypeField string `json:"type"` - Links map[string]interface{} `json:"_links"` - Encoding string `json:"encoding"` - Git_url string `json:"git_url"` - Name string `json:"name"` - Content string `json:"content"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Key Webhooksdeploykey `json:"key"` // The [`deploy key`](https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key) resource. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Schemas []string `json:"schemas,omitempty"` - Scimtype string `json:"scimType,omitempty"` - Status int `json:"status,omitempty"` - Detail string `json:"detail,omitempty"` - Documentation_url string `json:"documentation_url,omitempty"` - Message string `json:"message,omitempty"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Permission string `json:"permission"` - User GeneratedType `json:"user"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes Webhooksprojectchanges `json:"changes"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. - Action string `json:"action"` - Assignee Webhooksuser `json:"assignee"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Pull_request map[string]interface{} `json:"pull_request"` - Sender GeneratedType `json:"sender"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Definition GeneratedType `json:"definition"` // Custom property defined on an organization - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id"` // The node ID for the deployment protection rule integration. - Slug string `json:"slug"` // The slugified name of the deployment protection rule integration. - Id int `json:"id"` // The unique identifier of the deployment protection rule integration. - Integration_url string `json:"integration_url"` // The URL for the endpoint to get details about the app. + Created_at string `json:"created_at"` + Node_id string `json:"node_id"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + Body string `json:"body"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - File_patterns []string `json:"file_patterns"` // Array of file patterns. Pull requests which change matching files must be approved by the specified team. File patterns use the same syntax as `.gitignore` files. - Minimum_approvals int `json:"minimum_approvals"` // Minimum number of approvals required from the specified team. If set to zero, the team will be added to the pull request but approval is optional. - Reviewer GeneratedType `json:"reviewer"` // A required reviewing team +// Webhooksproject represents the Webhooksproject schema from the OpenAPI specification +type Webhooksproject struct { + Created_at string `json:"created_at"` + Body string `json:"body"` // Body of the project + Id int `json:"id"` + Updated_at string `json:"updated_at"` + Number int `json:"number"` + State string `json:"state"` // State of the project; either 'open' or 'closed' + Url string `json:"url"` + Creator map[string]interface{} `json:"creator"` + Html_url string `json:"html_url"` + Name string `json:"name"` // Name of the project + Node_id string `json:"node_id"` + Owner_url string `json:"owner_url"` + Columns_url string `json:"columns_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Private bool `json:"private"` // Whether the repository is private. +// Repository represents the Repository schema from the OpenAPI specification +type Repository struct { + Open_issues_count int `json:"open_issues_count"` + Tags_url string `json:"tags_url"` + Git_commits_url string `json:"git_commits_url"` + Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. Stargazers_count int `json:"stargazers_count"` - Updated_at string `json:"updated_at"` - Full_name string `json:"full_name"` // The full, globally unique, name of the repository. - Id int `json:"id"` // A unique identifier of the repository. + Notifications_url string `json:"notifications_url"` + Id int64 `json:"id"` // Unique identifier of the repository + Mirror_url string `json:"mirror_url"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Branches_url string `json:"branches_url"` + Pulls_url string `json:"pulls_url"` + Watchers_count int `json:"watchers_count"` + Has_issues bool `json:"has_issues"` // Whether issues are enabled. + Permissions map[string]interface{} `json:"permissions,omitempty"` + Svn_url string `json:"svn_url"` + Starred_at string `json:"starred_at,omitempty"` + Comments_url string `json:"comments_url"` + Assignees_url string `json:"assignees_url"` + Language string `json:"language"` + Private bool `json:"private"` // Whether the repository is private or public. + Deployments_url string `json:"deployments_url"` + Issue_events_url string `json:"issue_events_url"` Name string `json:"name"` // The name of the repository. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2 GeneratedType `json:"projects_v2"` // A projects v2 project - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Updated_at string `json:"updated_at"` - Score float64 `json:"score"` - Curated bool `json:"curated"` - Name string `json:"name"` - Short_description string `json:"short_description"` - Released string `json:"released"` - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` - Created_by string `json:"created_by"` - Repository_count int `json:"repository_count,omitempty"` + Releases_url string `json:"releases_url"` + Downloads_url string `json:"downloads_url"` + Url string `json:"url"` + Topics []string `json:"topics,omitempty"` + Archive_url string `json:"archive_url"` + Pushed_at string `json:"pushed_at"` + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. + Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo + Has_projects bool `json:"has_projects"` // Whether projects are enabled. + Clone_url string `json:"clone_url"` + Full_name string `json:"full_name"` + Issue_comment_url string `json:"issue_comment_url"` + Milestones_url string `json:"milestones_url"` + Git_tags_url string `json:"git_tags_url"` + Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. + Blobs_url string `json:"blobs_url"` + Default_branch string `json:"default_branch"` // The default branch of the repository. + Teams_url string `json:"teams_url"` + Git_url string `json:"git_url"` + Archived bool `json:"archived"` // Whether the repository is archived. + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged + Has_pages bool `json:"has_pages"` + Ssh_url string `json:"ssh_url"` + Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). + Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. + Git_refs_url string `json:"git_refs_url"` + Languages_url string `json:"languages_url"` + Forks_url string `json:"forks_url"` + Statuses_url string `json:"statuses_url"` + Labels_url string `json:"labels_url"` + Merges_url string `json:"merges_url"` + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. + Forks int `json:"forks"` + Subscription_url string `json:"subscription_url"` + Events_url string `json:"events_url"` + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Subscribers_url string `json:"subscribers_url"` + Collaborators_url string `json:"collaborators_url"` + Stargazers_url string `json:"stargazers_url"` + Contents_url string `json:"contents_url"` + Master_branch string `json:"master_branch,omitempty"` + Issues_url string `json:"issues_url"` + Contributors_url string `json:"contributors_url"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + Node_id string `json:"node_id"` + Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. + Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository + Html_url string `json:"html_url"` + Fork bool `json:"fork"` + Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. + Trees_url string `json:"trees_url"` Created_at string `json:"created_at"` + Homepage string `json:"homepage"` + Updated_at string `json:"updated_at"` + Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. + Keys_url string `json:"keys_url"` + Forks_count int `json:"forks_count"` + Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. + Code_search_index_status map[string]interface{} `json:"code_search_index_status,omitempty"` // The status of the code search index for this repository + Commits_url string `json:"commits_url"` + Open_issues int `json:"open_issues"` + Hooks_url string `json:"hooks_url"` + Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. + Compare_url string `json:"compare_url"` Description string `json:"description"` - Display_name string `json:"display_name"` - Related []map[string]interface{} `json:"related,omitempty"` - Aliases []map[string]interface{} `json:"aliases,omitempty"` - Featured bool `json:"featured"` - Logo_url string `json:"logo_url,omitempty"` + Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). + Watchers int `json:"watchers"` } -// Artifact represents the Artifact schema from the OpenAPI specification -type Artifact struct { - Digest string `json:"digest,omitempty"` // The SHA256 digest of the artifact. This field will only be populated on artifacts uploaded with upload-artifact v4 or newer. For older versions, this field will be null. - Expires_at string `json:"expires_at"` - Name string `json:"name"` // The name of the artifact. - Node_id string `json:"node_id"` - Archive_download_url string `json:"archive_download_url"` - Expired bool `json:"expired"` // Whether or not the artifact has expired. - Id int `json:"id"` - Size_in_bytes int `json:"size_in_bytes"` // The size in bytes of the artifact. - Updated_at string `json:"updated_at"` +// GeneratedType_Moved_column_in_project_issue_event represents the GeneratedType_Moved_column_in_project_issue_event schema from the OpenAPI specification +type GeneratedType_Moved_column_in_project_issue_event struct { Created_at string `json:"created_at"` + Node_id string `json:"node_id"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_url string `json:"commit_url"` + Event string `json:"event"` + Project_card map[string]interface{} `json:"project_card,omitempty"` Url string `json:"url"` - Workflow_run map[string]interface{} `json:"workflow_run,omitempty"` + Id int `json:"id"` + Commit_id string `json:"commit_id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` - Description string `json:"description,omitempty"` // A short description of the enterprise. - Slug string `json:"slug"` // The slug url identifier for the enterprise. - Updated_at string `json:"updated_at"` +// GeneratedType_Content_file represents the GeneratedType_Content_file schema from the OpenAPI specification +type GeneratedType_Content_file struct { + Encoding string `json:"encoding"` + Sha string `json:"sha"` + Submodule_git_url string `json:"submodule_git_url,omitempty"` + Name string `json:"name"` + Content string `json:"content"` + Git_url string `json:"git_url"` Html_url string `json:"html_url"` - Node_id string `json:"node_id"` - Website_url string `json:"website_url,omitempty"` // The enterprise's website URL. - Id int `json:"id"` // Unique identifier of the enterprise - Name string `json:"name"` // The name of the enterprise. - Avatar_url string `json:"avatar_url"` + Path string `json:"path"` + Download_url string `json:"download_url"` + Size int `json:"size"` + Target string `json:"target,omitempty"` + TypeField string `json:"type"` + Url string `json:"url"` + Links map[string]interface{} `json:"_links"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_card interface{} `json:"project_card"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` +// GeneratedType_Review_custom_gates_comment_required represents the GeneratedType_Review_custom_gates_comment_required schema from the OpenAPI specification +type GeneratedType_Review_custom_gates_comment_required struct { + Comment string `json:"comment"` // Comment associated with the pending deployment protection rule. **Required when state is not provided.** + Environment_name string `json:"environment_name"` // The name of the environment to approve or reject. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Merge_group GeneratedType `json:"merge_group"` // A group of pull requests that the merge queue has grouped together to be merged. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Reason string `json:"reason,omitempty"` // Explains why the merge group is being destroyed. The group could have been merged, removed from the queue (dequeued), or invalidated by an earlier queue entry being dequeued (invalidated). - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_workflow_run_completed represents the GeneratedType_Webhook_workflow_run_completed schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_run_completed struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow Webhooksworkflow `json:"workflow"` + Workflow_run map[string]interface{} `json:"workflow_run"` Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Old_answer Webhooksanswer `json:"old_answer"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Private_user represents the GeneratedType_Private_user schema from the OpenAPI specification +type GeneratedType_Private_user struct { + Total_private_repos int `json:"total_private_repos"` + Notification_email string `json:"notification_email,omitempty"` + Url string `json:"url"` + Gravatar_id string `json:"gravatar_id"` + Node_id string `json:"node_id"` + Html_url string `json:"html_url"` + Site_admin bool `json:"site_admin"` + Subscriptions_url string `json:"subscriptions_url"` + Repos_url string `json:"repos_url"` + Location string `json:"location"` + Events_url string `json:"events_url"` + Following_url string `json:"following_url"` + TypeField string `json:"type"` + Avatar_url string `json:"avatar_url"` + Created_at string `json:"created_at"` + Owned_private_repos int `json:"owned_private_repos"` + Ldap_dn string `json:"ldap_dn,omitempty"` + Starred_url string `json:"starred_url"` + Gists_url string `json:"gists_url"` + Private_gists int `json:"private_gists"` + Plan map[string]interface{} `json:"plan,omitempty"` + Company string `json:"company"` + Hireable bool `json:"hireable"` + Updated_at string `json:"updated_at"` + Email string `json:"email"` + Disk_usage int `json:"disk_usage"` + Login string `json:"login"` + Twitter_username string `json:"twitter_username,omitempty"` + Bio string `json:"bio"` + User_view_type string `json:"user_view_type,omitempty"` + Public_gists int `json:"public_gists"` + Collaborators int `json:"collaborators"` + Followers_url string `json:"followers_url"` + Two_factor_authentication bool `json:"two_factor_authentication"` + Id int64 `json:"id"` + Blog string `json:"blog"` + Following int `json:"following"` + Name string `json:"name"` + Public_repos int `json:"public_repos"` + Organizations_url string `json:"organizations_url"` + Followers int `json:"followers"` + Received_events_url string `json:"received_events_url"` + Business_plus bool `json:"business_plus,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Security_advisory GeneratedType `json:"security_advisory"` // Details for the GitHub Security Advisory. - Html_url string `json:"html_url"` // The GitHub URL of the alert resource. - Dismissed_by GeneratedType `json:"dismissed_by"` // A GitHub user. - Updated_at string `json:"updated_at"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Dismissed_comment string `json:"dismissed_comment"` // An optional comment associated with the alert's dismissal. - Number int `json:"number"` // The security alert number. - State string `json:"state"` // The state of the Dependabot alert. - Url string `json:"url"` // The REST API URL of the alert resource. - Dependency map[string]interface{} `json:"dependency"` // Details for the vulnerable dependency. - Dismissed_reason string `json:"dismissed_reason"` // The reason that the alert was dismissed. - Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Fixed_at string `json:"fixed_at"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Security_vulnerability GeneratedType `json:"security_vulnerability"` // Details pertaining to one vulnerable version range for the advisory. - Auto_dismissed_at string `json:"auto_dismissed_at,omitempty"` // The time that the alert was auto-dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. +// GeneratedType_Gist_simple represents the GeneratedType_Gist_simple schema from the OpenAPI specification +type GeneratedType_Gist_simple struct { + Owner GeneratedType_Simple_user `json:"owner,omitempty"` // A GitHub user. + Git_pull_url string `json:"git_pull_url,omitempty"` + Updated_at string `json:"updated_at,omitempty"` + Forks []map[string]interface{} `json:"forks,omitempty"` + History []GeneratedType_Gist_history `json:"history,omitempty"` + Node_id string `json:"node_id,omitempty"` + Public bool `json:"public,omitempty"` + Truncated bool `json:"truncated,omitempty"` + Created_at string `json:"created_at,omitempty"` + User string `json:"user,omitempty"` + Comments int `json:"comments,omitempty"` + Git_push_url string `json:"git_push_url,omitempty"` + Html_url string `json:"html_url,omitempty"` + Comments_url string `json:"comments_url,omitempty"` + Forks_url string `json:"forks_url,omitempty"` + Id string `json:"id,omitempty"` + Comments_enabled bool `json:"comments_enabled,omitempty"` + Files map[string]interface{} `json:"files,omitempty"` + Fork_of map[string]interface{} `json:"fork_of,omitempty"` // Gist + Url string `json:"url,omitempty"` + Description string `json:"description,omitempty"` + Commits_url string `json:"commits_url,omitempty"` +} + +// GeneratedType_Installation_token represents the GeneratedType_Installation_token schema from the OpenAPI specification +type GeneratedType_Installation_token struct { + Has_multiple_single_files bool `json:"has_multiple_single_files,omitempty"` + Permissions GeneratedType_App_permissions `json:"permissions,omitempty"` // The permissions granted to the user access token. + Repositories []Repository `json:"repositories,omitempty"` + Repository_selection string `json:"repository_selection,omitempty"` + Single_file string `json:"single_file,omitempty"` + Single_file_paths []string `json:"single_file_paths,omitempty"` + Token string `json:"token"` + Expires_at string `json:"expires_at"` +} + +// GeneratedType_Runner_groups_org represents the GeneratedType_Runner_groups_org schema from the OpenAPI specification +type GeneratedType_Runner_groups_org struct { + Selected_workflows []string `json:"selected_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless `restricted_to_workflows` is set to `true`. + Visibility string `json:"visibility"` + Workflow_restrictions_read_only bool `json:"workflow_restrictions_read_only,omitempty"` // If `true`, the `restricted_to_workflows` and `selected_workflows` fields cannot be modified. + Hosted_runners_url string `json:"hosted_runners_url,omitempty"` + Inherited bool `json:"inherited"` + Name string `json:"name"` + Allows_public_repositories bool `json:"allows_public_repositories"` + Id float64 `json:"id"` + Selected_repositories_url string `json:"selected_repositories_url,omitempty"` // Link to the selected repositories resource for this runner group. Not present unless visibility was set to `selected` + DefaultField bool `json:"default"` + Inherited_allows_public_repositories bool `json:"inherited_allows_public_repositories,omitempty"` + Network_configuration_id string `json:"network_configuration_id,omitempty"` // The identifier of a hosted compute network configuration. + Restricted_to_workflows bool `json:"restricted_to_workflows,omitempty"` // If `true`, the runner group will be restricted to running only the workflows specified in the `selected_workflows` array. + Runners_url string `json:"runners_url"` +} + +// GeneratedType_Secret_scanning_alert_webhook represents the GeneratedType_Secret_scanning_alert_webhook schema from the OpenAPI specification +type GeneratedType_Secret_scanning_alert_webhook struct { + Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Push_protection_bypassed_at string `json:"push_protection_bypassed_at,omitempty"` // The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Push_protection_bypass_request_html_url string `json:"push_protection_bypass_request_html_url,omitempty"` // The URL to a push protection bypass request. + Push_protection_bypassed_by GeneratedType_Nullable_simple_user `json:"push_protection_bypassed_by,omitempty"` // A GitHub user. + Number int `json:"number,omitempty"` // The security alert number. + Secret_type_display_name string `json:"secret_type_display_name,omitempty"` // User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)." + Publicly_leaked bool `json:"publicly_leaked,omitempty"` // Whether the detected secret was publicly leaked. + Resolved_by GeneratedType_Nullable_simple_user `json:"resolved_by,omitempty"` // A GitHub user. + Created_at string `json:"created_at,omitempty"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Locations_url string `json:"locations_url,omitempty"` // The REST API URL of the code locations for this alert. + Html_url string `json:"html_url,omitempty"` // The GitHub URL of the alert resource. + Push_protection_bypass_request_comment string `json:"push_protection_bypass_request_comment,omitempty"` // An optional comment when requesting a push protection bypass. + Resolution_comment string `json:"resolution_comment,omitempty"` // An optional comment to resolve an alert. + Url string `json:"url,omitempty"` // The REST API URL of the alert resource. + Resolution string `json:"resolution,omitempty"` // The reason for resolving the alert. + Secret_type string `json:"secret_type,omitempty"` // The type of secret that secret scanning detected. + Validity string `json:"validity,omitempty"` // The token status as of the latest validity check. + Push_protection_bypassed bool `json:"push_protection_bypassed,omitempty"` // Whether push protection was bypassed for the detected secret. + Multi_repo bool `json:"multi_repo,omitempty"` // Whether the detected secret was found in multiple repositories in the same organization or business. + Push_protection_bypass_request_reviewer GeneratedType_Nullable_simple_user `json:"push_protection_bypass_request_reviewer,omitempty"` // A GitHub user. + Push_protection_bypass_request_reviewer_comment string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` // An optional comment when reviewing a push protection bypass. + Resolved_at string `json:"resolved_at,omitempty"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. +} + +// GeneratedType_Deploy_key represents the GeneratedType_Deploy_key schema from the OpenAPI specification +type GeneratedType_Deploy_key struct { + Added_by string `json:"added_by,omitempty"` + Created_at string `json:"created_at"` + Read_only bool `json:"read_only"` + Title string `json:"title"` + Verified bool `json:"verified"` + Url string `json:"url"` + Enabled bool `json:"enabled,omitempty"` + Id int `json:"id"` + Last_used string `json:"last_used,omitempty"` + Key string `json:"key"` +} + +// GeneratedType_Repo_search_result_item represents the GeneratedType_Repo_search_result_item schema from the OpenAPI specification +type GeneratedType_Repo_search_result_item struct { + Permissions map[string]interface{} `json:"permissions,omitempty"` + Trees_url string `json:"trees_url"` + Language string `json:"language"` + Has_projects bool `json:"has_projects"` + Has_discussions bool `json:"has_discussions,omitempty"` + Blobs_url string `json:"blobs_url"` + Events_url string `json:"events_url"` + Description string `json:"description"` + Owner GeneratedType_Nullable_simple_user `json:"owner"` // A GitHub user. + Issues_url string `json:"issues_url"` + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Has_issues bool `json:"has_issues"` + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` + Has_wiki bool `json:"has_wiki"` + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` + Tags_url string `json:"tags_url"` + Compare_url string `json:"compare_url"` + Git_refs_url string `json:"git_refs_url"` + Statuses_url string `json:"statuses_url"` + Downloads_url string `json:"downloads_url"` + Mirror_url string `json:"mirror_url"` + Archived bool `json:"archived"` + Branches_url string `json:"branches_url"` + Topics []string `json:"topics,omitempty"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Clone_url string `json:"clone_url"` + Languages_url string `json:"languages_url"` + Size int `json:"size"` + Comments_url string `json:"comments_url"` + Updated_at string `json:"updated_at"` + Fork bool `json:"fork"` + Git_commits_url string `json:"git_commits_url"` + Allow_forking bool `json:"allow_forking,omitempty"` + Commits_url string `json:"commits_url"` + Milestones_url string `json:"milestones_url"` + Node_id string `json:"node_id"` + Notifications_url string `json:"notifications_url"` + Stargazers_count int `json:"stargazers_count"` + Private bool `json:"private"` + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` + Issue_comment_url string `json:"issue_comment_url"` + Labels_url string `json:"labels_url"` + Subscribers_url string `json:"subscribers_url"` + Id int `json:"id"` + Contributors_url string `json:"contributors_url"` + Score float64 `json:"score"` + Svn_url string `json:"svn_url"` + Stargazers_url string `json:"stargazers_url"` + Subscription_url string `json:"subscription_url"` + Hooks_url string `json:"hooks_url"` + Homepage string `json:"homepage"` + Issue_events_url string `json:"issue_events_url"` + Open_issues int `json:"open_issues"` + Created_at string `json:"created_at"` + Forks_count int `json:"forks_count"` + Html_url string `json:"html_url"` + Contents_url string `json:"contents_url"` + Is_template bool `json:"is_template,omitempty"` + Keys_url string `json:"keys_url"` + Pulls_url string `json:"pulls_url"` + Has_downloads bool `json:"has_downloads"` + Git_tags_url string `json:"git_tags_url"` + Has_pages bool `json:"has_pages"` + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Forks_url string `json:"forks_url"` + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` + Merges_url string `json:"merges_url"` + Teams_url string `json:"teams_url"` + Watchers_count int `json:"watchers_count"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Git_url string `json:"git_url"` + Archive_url string `json:"archive_url"` + Master_branch string `json:"master_branch,omitempty"` + Deployments_url string `json:"deployments_url"` + Full_name string `json:"full_name"` + Watchers int `json:"watchers"` + Collaborators_url string `json:"collaborators_url"` + Default_branch string `json:"default_branch"` + Releases_url string `json:"releases_url"` + Url string `json:"url"` + Ssh_url string `json:"ssh_url"` + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Open_issues_count int `json:"open_issues_count"` + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` + Pushed_at string `json:"pushed_at"` + Assignees_url string `json:"assignees_url"` + Name string `json:"name"` + Forks int `json:"forks"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` +} + +// Webhooksreviewcomment represents the Webhooksreviewcomment schema from the OpenAPI specification +type Webhooksreviewcomment struct { + Subject_type string `json:"subject_type,omitempty"` // The level at which the comment is targeted, can be a diff line or a file. + Body string `json:"body"` // The text of the comment. + Original_commit_id string `json:"original_commit_id"` // The SHA of the original commit to which the comment applies. + Original_line int `json:"original_line"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment + Links map[string]interface{} `json:"_links"` + Id int `json:"id"` // The ID of the pull request review comment. + Pull_request_url string `json:"pull_request_url"` // URL for the pull request that the review comment belongs to. + Start_side string `json:"start_side"` // The side of the first line of the range for a multi-line comment. + Updated_at string `json:"updated_at"` + Diff_hunk string `json:"diff_hunk"` // The diff of the line that the comment refers to. + Original_position int `json:"original_position"` // The index of the original line in the diff to which the comment applies. + Position int `json:"position"` // The line index in the diff to which the comment applies. + Start_line int `json:"start_line"` // The first line of the range for a multi-line comment. + Url string `json:"url"` // URL for the pull request review comment + Commit_id string `json:"commit_id"` // The SHA of the commit to which the comment applies. + Side string `json:"side"` // The side of the first line of the range for a multi-line comment. + User map[string]interface{} `json:"user"` + Html_url string `json:"html_url"` // HTML URL for the pull request review comment. + In_reply_to_id int `json:"in_reply_to_id,omitempty"` // The comment ID to reply to. + Line int `json:"line"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment + Path string `json:"path"` // The relative path of the file to which the comment applies. + Pull_request_review_id int `json:"pull_request_review_id"` // The ID of the pull request review to which the comment belongs. + Original_start_line int `json:"original_start_line"` // The first line of the range for a multi-line comment. + Author_association string `json:"author_association"` // How the author is associated with the repository. + Created_at string `json:"created_at"` + Node_id string `json:"node_id"` // The node ID of the pull request review comment. + Reactions map[string]interface{} `json:"reactions"` +} + +// GeneratedType_Webhook_projects_v2_item_restored represents the GeneratedType_Webhook_projects_v2_item_restored schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_restored struct { + Changes Webhooksprojectchanges `json:"changes"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` +} + +// Page represents the Page schema from the OpenAPI specification +type Page struct { + Protected_domain_state string `json:"protected_domain_state,omitempty"` // The state if the domain is verified + Cname string `json:"cname"` // The Pages site's custom domain + Https_certificate GeneratedType_Pages_https_certificate `json:"https_certificate,omitempty"` + Https_enforced bool `json:"https_enforced,omitempty"` // Whether https is enabled on the domain + Status string `json:"status"` // The status of the most recent build of the Page. + Html_url string `json:"html_url,omitempty"` // The web address the Page can be accessed from. + Url string `json:"url"` // The API address for accessing this Page resource. + Build_type string `json:"build_type,omitempty"` // The process in which the Page will be built. + Pending_domain_unverified_at string `json:"pending_domain_unverified_at,omitempty"` // The timestamp when a pending domain becomes unverified. + Public bool `json:"public"` // Whether the GitHub Pages site is publicly visible. If set to `true`, the site is accessible to anyone on the internet. If set to `false`, the site will only be accessible to users who have at least `read` access to the repository that published the site. + Source GeneratedType_Pages_source_hash `json:"source,omitempty"` + Custom_404 bool `json:"custom_404"` // Whether the Page has a custom 404 page. +} + +// GeneratedType_Rate_limit represents the GeneratedType_Rate_limit schema from the OpenAPI specification +type GeneratedType_Rate_limit struct { + Reset int `json:"reset"` + Used int `json:"used"` + Limit int `json:"limit"` + Remaining int `json:"remaining"` +} + +// Webhooksrelease represents the Webhooksrelease schema from the OpenAPI specification +type Webhooksrelease struct { + Url string `json:"url"` + Assets []map[string]interface{} `json:"assets"` + Assets_url string `json:"assets_url"` + Id int `json:"id"` + Target_commitish string `json:"target_commitish"` // Specifies the commitish value that determines where the Git tag is created from. + Draft bool `json:"draft"` // Whether the release is a draft or published + Created_at string `json:"created_at"` + Name string `json:"name"` + Node_id string `json:"node_id"` + Upload_url string `json:"upload_url"` + Body string `json:"body"` + Prerelease bool `json:"prerelease"` // Whether the release is identified as a prerelease or a full release. + Tarball_url string `json:"tarball_url"` + Author map[string]interface{} `json:"author"` + Tag_name string `json:"tag_name"` // The name of the tag. + Reactions map[string]interface{} `json:"reactions,omitempty"` + Published_at string `json:"published_at"` + Discussion_url string `json:"discussion_url,omitempty"` + Zipball_url string `json:"zipball_url"` + Html_url string `json:"html_url"` +} + +// GeneratedType_Team_discussion_comment represents the GeneratedType_Team_discussion_comment schema from the OpenAPI specification +type GeneratedType_Team_discussion_comment struct { + Body_version string `json:"body_version"` // The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + Discussion_url string `json:"discussion_url"` + Last_edited_at string `json:"last_edited_at"` + Number int `json:"number"` // The unique sequence number of a team discussion comment. + Created_at string `json:"created_at"` + Html_url string `json:"html_url"` + Author GeneratedType_Nullable_simple_user `json:"author"` // A GitHub user. + Node_id string `json:"node_id"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Updated_at string `json:"updated_at"` + Url string `json:"url"` + Body string `json:"body"` // The main text of the comment. + Body_html string `json:"body_html"` +} + +// GeneratedType_Webhook_deploy_key_created represents the GeneratedType_Webhook_deploy_key_created schema from the OpenAPI specification +type GeneratedType_Webhook_deploy_key_created struct { + Key Webhooksdeploykey `json:"key"` // The [`deploy key`](https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key) resource. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +} + +// GeneratedType_Webhook_installation_created represents the GeneratedType_Webhook_installation_created schema from the OpenAPI specification +type GeneratedType_Webhook_installation_created struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation Installation `json:"installation"` // Installation + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requester Webhooksuser `json:"requester,omitempty"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. +} + +// GeneratedType_Webhook_issues_reopened represents the GeneratedType_Webhook_issues_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_issues_reopened struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +} + +// GeneratedType_Pull_request_webhook represents the GeneratedType_Pull_request_webhook schema from the OpenAPI specification +type GeneratedType_Pull_request_webhook struct { + Links map[string]interface{} `json:"_links"` + Merged bool `json:"merged"` + Merge_commit_sha string `json:"merge_commit_sha"` + Commits int `json:"commits"` + Updated_at string `json:"updated_at"` + User GeneratedType_Simple_user `json:"user"` // A GitHub user. + Mergeable bool `json:"mergeable"` + Title string `json:"title"` // The title of the pull request. + Changed_files int `json:"changed_files"` + Deletions int `json:"deletions"` + Mergeable_state string `json:"mergeable_state"` + Number int `json:"number"` // Number uniquely identifying the pull request within its repository. + Diff_url string `json:"diff_url"` + Additions int `json:"additions"` + Locked bool `json:"locked"` + Requested_reviewers []GeneratedType_Simple_user `json:"requested_reviewers,omitempty"` + Head map[string]interface{} `json:"head"` + Maintainer_can_modify bool `json:"maintainer_can_modify"` // Indicates whether maintainers can modify the pull request. + Body string `json:"body"` + Requested_teams []GeneratedType_Team_simple `json:"requested_teams,omitempty"` + Labels []map[string]interface{} `json:"labels"` + Auto_merge GeneratedType_Auto_merge `json:"auto_merge"` // The status of auto merging a pull request. + Closed_at string `json:"closed_at"` + Patch_url string `json:"patch_url"` + Draft bool `json:"draft,omitempty"` // Indicates whether or not the pull request is a draft. + Merged_by GeneratedType_Nullable_simple_user `json:"merged_by"` // A GitHub user. + Review_comment_url string `json:"review_comment_url"` + Comments int `json:"comments"` + Merged_at string `json:"merged_at"` + Id int64 `json:"id"` + Assignee GeneratedType_Nullable_simple_user `json:"assignee"` // A GitHub user. + Statuses_url string `json:"statuses_url"` + Created_at string `json:"created_at"` + Html_url string `json:"html_url"` + Rebaseable bool `json:"rebaseable,omitempty"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + State string `json:"state"` // State of this Pull Request. Either `open` or `closed`. + Review_comments_url string `json:"review_comments_url"` + Base map[string]interface{} `json:"base"` + Review_comments int `json:"review_comments"` + Commits_url string `json:"commits_url"` + Assignees []GeneratedType_Simple_user `json:"assignees,omitempty"` + Comments_url string `json:"comments_url"` + Milestone GeneratedType_Nullable_milestone `json:"milestone"` // A collection of related issues and pull requests. + Node_id string `json:"node_id"` + Issue_url string `json:"issue_url"` + Active_lock_reason string `json:"active_lock_reason,omitempty"` + Url string `json:"url"` + Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether to allow updating the pull request's branch. + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged. + Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. + Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., "Merge pull request #123 from branch-name"). + Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). + Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead.** + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow auto-merge for pull requests. +} + +// Webhookslabel represents the Webhookslabel schema from the OpenAPI specification +type Webhookslabel struct { + Name string `json:"name"` // The name of the label. + Node_id string `json:"node_id"` + Url string `json:"url"` // URL for the label + Color string `json:"color"` // 6-character hex code, without the leading #, identifying the color + DefaultField bool `json:"default"` + Description string `json:"description"` + Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Runner_label string `json:"runner_label,omitempty"` // Runner label to be used if the runner type is labeled. - Runner_type string `json:"runner_type,omitempty"` // Runner type to be used. - State string `json:"state,omitempty"` // The desired state of code scanning default setup. - Threat_model string `json:"threat_model,omitempty"` // Threat model to be used for code scanning analysis. Use `remote` to analyze only network sources and `remote_and_local` to include local sources like filesystem access, command-line arguments, database reads, environment variable and standard input. - Languages []string `json:"languages,omitempty"` // CodeQL languages to be analyzed. - Query_suite string `json:"query_suite,omitempty"` // CodeQL query suite to be used. +// GeneratedType_Dependabot_secret represents the GeneratedType_Dependabot_secret schema from the OpenAPI specification +type GeneratedType_Dependabot_secret struct { + Created_at string `json:"created_at"` + Name string `json:"name"` // The name of the secret. + Updated_at string `json:"updated_at"` } -// Webhooksissuecomment represents the Webhooksissuecomment schema from the OpenAPI specification -type Webhooksissuecomment struct { +// GeneratedType_Workflow_run represents the GeneratedType_Workflow_run schema from the OpenAPI specification +type GeneratedType_Workflow_run struct { + Check_suite_id int `json:"check_suite_id,omitempty"` // The ID of the associated check suite. + Artifacts_url string `json:"artifacts_url"` // The URL to the artifacts for the workflow run. + Run_started_at string `json:"run_started_at,omitempty"` // The start time of the latest run. Resets on re-run. + Url string `json:"url"` // The URL to the workflow run. + Triggering_actor GeneratedType_Simple_user `json:"triggering_actor,omitempty"` // A GitHub user. + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + Display_title string `json:"display_title"` // The event-specific title associated with the run or the run-name if set, or the value of `run-name` if it is set in the workflow. + Logs_url string `json:"logs_url"` // The URL to download the logs for the workflow run. + Head_repository GeneratedType_Minimal_repository `json:"head_repository"` // Minimal Repository + Jobs_url string `json:"jobs_url"` // The URL to the jobs for the workflow run. + Path string `json:"path"` // The full path of the workflow + Workflow_url string `json:"workflow_url"` // The URL to the workflow. + Event string `json:"event"` + Rerun_url string `json:"rerun_url"` // The URL to rerun the workflow run. + Previous_attempt_url string `json:"previous_attempt_url,omitempty"` // The URL to the previous attempted run of this workflow, if one exists. + Head_repository_id int `json:"head_repository_id,omitempty"` Node_id string `json:"node_id"` - Reactions map[string]interface{} `json:"reactions"` - Url string `json:"url"` // URL for the issue comment - User map[string]interface{} `json:"user"` - Html_url string `json:"html_url"` - Performed_via_github_app Integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Cancel_url string `json:"cancel_url"` // The URL to cancel the workflow run. + Status string `json:"status"` + Pull_requests []GeneratedType_Pull_request_minimal `json:"pull_requests"` // Pull requests that are open with a `head_sha` or `head_branch` that matches the workflow run. The returned pull requests do not necessarily indicate pull requests that triggered the run. + Referenced_workflows []GeneratedType_Referenced_workflow `json:"referenced_workflows,omitempty"` + Run_number int `json:"run_number"` // The auto incrementing run number for the workflow run. + Conclusion string `json:"conclusion"` + Head_commit GeneratedType_Nullable_simple_commit `json:"head_commit"` // A commit. + Head_sha string `json:"head_sha"` // The SHA of the head commit that points to the version of the workflow being run. Created_at string `json:"created_at"` - Id int64 `json:"id"` // Unique identifier of the issue comment - Issue_url string `json:"issue_url"` + Check_suite_node_id string `json:"check_suite_node_id,omitempty"` // The node ID of the associated check suite. + Id int `json:"id"` // The ID of the workflow run. Updated_at string `json:"updated_at"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Body string `json:"body"` // Contents of the issue comment + Workflow_id int `json:"workflow_id"` // The ID of the parent workflow. + Actor GeneratedType_Simple_user `json:"actor,omitempty"` // A GitHub user. + Head_branch string `json:"head_branch"` + Html_url string `json:"html_url"` + Check_suite_url string `json:"check_suite_url"` // The URL to the associated check suite. + Name string `json:"name,omitempty"` // The name of the workflow run. + Run_attempt int `json:"run_attempt,omitempty"` // Attempt number of the run, 1 for first attempt and higher if the workflow was re-run. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Webhook_pull_request_labeled represents the GeneratedType_Webhook_pull_request_labeled schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_labeled struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Number int `json:"number"` // The pull request number. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Action string `json:"action"` + Label Webhookslabel `json:"label,omitempty"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Branch string `json:"branch"` - Path string `json:"path"` +// GeneratedType_Deployment_protection_rule represents the GeneratedType_Deployment_protection_rule schema from the OpenAPI specification +type GeneratedType_Deployment_protection_rule struct { + Node_id string `json:"node_id"` // The node ID for the deployment protection rule. + App GeneratedType_Custom_deployment_rule_app `json:"app"` // A GitHub App that is providing a custom deployment protection rule. + Enabled bool `json:"enabled"` // Whether the deployment protection rule is enabled for the environment. + Id int `json:"id"` // The unique identifier for the deployment protection rule. } -// Webhooksprojectcolumn represents the Webhooksprojectcolumn schema from the OpenAPI specification -type Webhooksprojectcolumn struct { - Node_id string `json:"node_id"` - After_id int `json:"after_id,omitempty"` - Cards_url string `json:"cards_url"` - Updated_at string `json:"updated_at"` - Id int `json:"id"` // The unique identifier of the project column - Name string `json:"name"` // Name of the project column - Project_url string `json:"project_url"` - Created_at string `json:"created_at"` - Url string `json:"url"` +// GeneratedType_Tag_protection represents the GeneratedType_Tag_protection schema from the OpenAPI specification +type GeneratedType_Tag_protection struct { + Id int `json:"id,omitempty"` + Pattern string `json:"pattern"` + Updated_at string `json:"updated_at,omitempty"` + Created_at string `json:"created_at,omitempty"` + Enabled bool `json:"enabled,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the secret. - Selected_repositories_url string `json:"selected_repositories_url,omitempty"` - Updated_at string `json:"updated_at"` - Visibility string `json:"visibility"` // Visibility of a secret - Created_at string `json:"created_at"` +// GeneratedType_Codespaces_secret represents the GeneratedType_Codespaces_secret schema from the OpenAPI specification +type GeneratedType_Codespaces_secret struct { + Created_at string `json:"created_at"` // The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Name string `json:"name"` // The name of the secret + Selected_repositories_url string `json:"selected_repositories_url"` // The API URL at which the list of repositories this secret is visible to can be retrieved + Updated_at string `json:"updated_at"` // The date and time at which the secret was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Visibility string `json:"visibility"` // The type of repositories in the organization that the secret is visible to } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Webhook_issues_opened represents the GeneratedType_Webhook_issues_opened schema from the OpenAPI specification +type GeneratedType_Webhook_issues_opened struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Label Webhookslabel `json:"label,omitempty"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Changes map[string]interface{} `json:"changes,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - New_property_values []GeneratedType `json:"new_property_values"` // The new custom property values for the repository. - Old_property_values []GeneratedType `json:"old_property_values"` // The old custom property values for the repository. - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_label_edited represents the GeneratedType_Webhook_label_edited schema from the OpenAPI specification +type GeneratedType_Webhook_label_edited struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Label Webhookslabel `json:"label"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Changes map[string]interface{} `json:"changes,omitempty"` // The changes to the label if the action was `edited`. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Visibility string `json:"visibility"` // The type of repositories in the organization that the secret is visible to - Created_at string `json:"created_at"` // The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Name string `json:"name"` // The name of the secret - Selected_repositories_url string `json:"selected_repositories_url,omitempty"` // The API URL at which the list of repositories this secret is visible to can be retrieved - Updated_at string `json:"updated_at"` // The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. +// GeneratedType_Page_build_status represents the GeneratedType_Page_build_status schema from the OpenAPI specification +type GeneratedType_Page_build_status struct { + Status string `json:"status"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_organization_renamed represents the GeneratedType_Webhook_organization_renamed schema from the OpenAPI specification +type GeneratedType_Webhook_organization_renamed struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Changes map[string]interface{} `json:"changes,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Membership Webhooksmembership `json:"membership,omitempty"` // The membership between the user and the organization. Not present when the action is `member_invited`. + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Clones []Traffic `json:"clones"` - Count int `json:"count"` - Uniques int `json:"uniques"` +// GeneratedType_Webhook_personal_access_token_request_cancelled represents the GeneratedType_Webhook_personal_access_token_request_cancelled schema from the OpenAPI specification +type GeneratedType_Webhook_personal_access_token_request_cancelled struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Personal_access_token_request GeneratedType_Personal_access_token_request `json:"personal_access_token_request"` // Details of a Personal Access Token Request. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Errors []map[string]interface{} `json:"errors"` +// GeneratedType_Nullable_actions_hosted_runner_pool_image represents the GeneratedType_Nullable_actions_hosted_runner_pool_image schema from the OpenAPI specification +type GeneratedType_Nullable_actions_hosted_runner_pool_image struct { + Size_gb int `json:"size_gb"` // Image size in GB. + Source string `json:"source"` // The image provider. + Display_name string `json:"display_name"` // Display name for this image. + Id string `json:"id"` // The ID of the image. Use this ID for the `image` parameter when creating a new larger runner. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Body string `json:"body"` // The comment text. - Created_at string `json:"created_at"` - Id int `json:"id"` - Node_id string `json:"node_id"` - Updated_at string `json:"updated_at"` - Url string `json:"url"` - User GeneratedType `json:"user"` // A GitHub user. - Author_association string `json:"author_association"` // How the author is associated with the repository. +// GeneratedType_Webhook_check_run_completed represents the GeneratedType_Webhook_check_run_completed schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_completed struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action,omitempty"` + Check_run GeneratedType_Check_run_with_simple_check_suite `json:"check_run"` // A check performed on the code of a given code change + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Message string `json:"message"` // Message describing the purpose of the tag - Node_id string `json:"node_id"` - Object map[string]interface{} `json:"object"` - Sha string `json:"sha"` - Tag string `json:"tag"` // Name of the tag - Tagger map[string]interface{} `json:"tagger"` - Url string `json:"url"` // URL for the tag - Verification Verification `json:"verification,omitempty"` +// GeneratedType_Branch_with_protection represents the GeneratedType_Branch_with_protection schema from the OpenAPI specification +type GeneratedType_Branch_with_protection struct { + Pattern string `json:"pattern,omitempty"` + Protected bool `json:"protected"` + Protection GeneratedType_Branch_protection `json:"protection"` // Branch Protection + Protection_url string `json:"protection_url"` + Required_approving_review_count int `json:"required_approving_review_count,omitempty"` + Links map[string]interface{} `json:"_links"` + Commit Commit `json:"commit"` // Commit + Name string `json:"name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow Webhooksworkflow `json:"workflow"` - Workflow_run map[string]interface{} `json:"workflow_run"` - Action string `json:"action"` +// Webhookspreviousmarketplacepurchase represents the Webhookspreviousmarketplacepurchase schema from the OpenAPI specification +type Webhookspreviousmarketplacepurchase struct { + Plan map[string]interface{} `json:"plan"` + Unit_count int `json:"unit_count"` + Account map[string]interface{} `json:"account"` + Billing_cycle string `json:"billing_cycle"` + Free_trial_ends_on interface{} `json:"free_trial_ends_on"` + Next_billing_date string `json:"next_billing_date,omitempty"` + On_free_trial bool `json:"on_free_trial"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Limit int `json:"limit"` - Remaining int `json:"remaining"` - Reset int `json:"reset"` - Used int `json:"used"` +// Enterprise represents the Enterprise schema from the OpenAPI specification +type Enterprise struct { + Avatar_url string `json:"avatar_url"` + Created_at string `json:"created_at"` + Description string `json:"description,omitempty"` // A short description of the enterprise. + Name string `json:"name"` // The name of the enterprise. + Updated_at string `json:"updated_at"` + Html_url string `json:"html_url"` + Slug string `json:"slug"` // The slug url identifier for the enterprise. + Website_url string `json:"website_url,omitempty"` // The enterprise's website URL. + Id int `json:"id"` // Unique identifier of the enterprise + Node_id string `json:"node_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_security_advisory_updated represents the GeneratedType_Webhook_security_advisory_updated schema from the OpenAPI specification +type GeneratedType_Webhook_security_advisory_updated struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Blocked_user Webhooksuser `json:"blocked_user"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Security_advisory Webhookssecurityadvisory `json:"security_advisory"` // The details of the security advisory, including summary, description, and severity. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Can_approve_pull_request_reviews bool `json:"can_approve_pull_request_reviews"` // Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. - Default_workflow_permissions string `json:"default_workflow_permissions"` // The default workflow permissions granted to the GITHUB_TOKEN when running workflows. +// Classroom represents the Classroom schema from the OpenAPI specification +type Classroom struct { + Archived bool `json:"archived"` // Whether classroom is archived. + Id int `json:"id"` // Unique identifier of the classroom. + Name string `json:"name"` // The name of the classroom. + Organization GeneratedType_Simple_classroom_organization `json:"organization"` // A GitHub organization. + Url string `json:"url"` // The URL of the classroom on GitHub Classroom. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - App GeneratedType `json:"app"` // A GitHub App that is providing a custom deployment protection rule. - Enabled bool `json:"enabled"` // Whether the deployment protection rule is enabled for the environment. - Id int `json:"id"` // The unique identifier for the deployment protection rule. - Node_id string `json:"node_id"` // The node ID for the deployment protection rule. +// GeneratedType_Repository_advisory_update represents the GeneratedType_Repository_advisory_update schema from the OpenAPI specification +type GeneratedType_Repository_advisory_update struct { + Vulnerabilities []map[string]interface{} `json:"vulnerabilities,omitempty"` // A product affected by the vulnerability detailed in a repository security advisory. + Cwe_ids []string `json:"cwe_ids,omitempty"` // A list of Common Weakness Enumeration (CWE) IDs. + Collaborating_users []string `json:"collaborating_users,omitempty"` // A list of usernames who have been granted write access to the advisory. + Cvss_vector_string string `json:"cvss_vector_string,omitempty"` // The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`. + Severity string `json:"severity,omitempty"` // The severity of the advisory. You must choose between setting this field or `cvss_vector_string`. + Summary string `json:"summary,omitempty"` // A short summary of the advisory. + Collaborating_teams []string `json:"collaborating_teams,omitempty"` // A list of team slugs which have been granted write access to the advisory. + Cve_id string `json:"cve_id,omitempty"` // The Common Vulnerabilities and Exposures (CVE) ID. + Description string `json:"description,omitempty"` // A detailed description of what the advisory impacts. + State string `json:"state,omitempty"` // The state of the advisory. + Credits []map[string]interface{} `json:"credits,omitempty"` // A list of users receiving credit for their participation in the security advisory. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Check_run GeneratedType `json:"check_run"` // A check performed on the code of a given code change - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requested_action map[string]interface{} `json:"requested_action,omitempty"` // The action requested by the user. - Sender GeneratedType `json:"sender"` // A GitHub user. +// Tag represents the Tag schema from the OpenAPI specification +type Tag struct { + Name string `json:"name"` + Node_id string `json:"node_id"` + Tarball_url string `json:"tarball_url"` + Zipball_url string `json:"zipball_url"` + Commit map[string]interface{} `json:"commit"` } -// Job represents the Job schema from the OpenAPI specification -type Job struct { - Status string `json:"status"` // The phase of the lifecycle that the job is currently in. - Steps []map[string]interface{} `json:"steps,omitempty"` // Steps in this job. - Head_sha string `json:"head_sha"` // The SHA of the commit that is being run. - Name string `json:"name"` // The name of the job. - Runner_id int `json:"runner_id"` // The ID of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) - Started_at string `json:"started_at"` // The time that the job started, in ISO 8601 format. +// GeneratedType_Webhook_commit_comment_created represents the GeneratedType_Webhook_commit_comment_created schema from the OpenAPI specification +type GeneratedType_Webhook_commit_comment_created struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` // The action performed. Can be `created`. + Comment map[string]interface{} `json:"comment"` // The [commit comment](${externalDocsUpapp/api/description/components/schemas/webhooks/issue-comment-created.yamlrl}/rest/commits/comments#get-a-commit-comment) resource. +} + +// GeneratedType_Short_blob represents the GeneratedType_Short_blob schema from the OpenAPI specification +type GeneratedType_Short_blob struct { Url string `json:"url"` - Html_url string `json:"html_url"` - Run_url string `json:"run_url"` - Runner_group_name string `json:"runner_group_name"` // The name of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) - Id int `json:"id"` // The id of the job. - Check_run_url string `json:"check_run_url"` - Labels []string `json:"labels"` // Labels for the workflow job. Specified by the "runs_on" attribute in the action's workflow file. - Run_attempt int `json:"run_attempt,omitempty"` // Attempt number of the associated workflow run, 1 for first attempt and higher if the workflow was re-run. - Created_at string `json:"created_at"` // The time that the job created, in ISO 8601 format. - Run_id int `json:"run_id"` // The id of the associated workflow run. - Runner_name string `json:"runner_name"` // The name of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) - Runner_group_id int `json:"runner_group_id"` // The ID of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) - Node_id string `json:"node_id"` - Conclusion string `json:"conclusion"` // The outcome of the job. - Head_branch string `json:"head_branch"` // The name of the current branch. - Workflow_name string `json:"workflow_name"` // The name of the workflow. - Completed_at string `json:"completed_at"` // The time that the job finished, in ISO 8601 format. + Sha string `json:"sha"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow Webhooksworkflow `json:"workflow"` - Workflow_run map[string]interface{} `json:"workflow_run"` +// GeneratedType_Webhook_discussion_closed represents the GeneratedType_Webhook_discussion_closed schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_closed struct { Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_repository_transferred represents the GeneratedType_Webhook_repository_transferred schema from the OpenAPI specification +type GeneratedType_Webhook_repository_transferred struct { + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Milestone Milestone `json:"milestone,omitempty"` // A collection of related issues and pull requests. - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request Webhookspullrequest5 `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Selected_actions represents the GeneratedType_Selected_actions schema from the OpenAPI specification +type GeneratedType_Selected_actions struct { + Github_owned_allowed bool `json:"github_owned_allowed,omitempty"` // Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization. + Patterns_allowed []string `json:"patterns_allowed,omitempty"` // Specifies a list of string-matching patterns to allow specific action(s) and reusable workflow(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`. > [!NOTE] > The `patterns_allowed` setting only applies to public repositories. + Verified_allowed bool `json:"verified_allowed,omitempty"` // Whether actions from GitHub Marketplace verified creators are allowed. Set to `true` to allow all actions by GitHub Marketplace verified creators. +} + +// GeneratedType_Locked_issue_event represents the GeneratedType_Locked_issue_event schema from the OpenAPI specification +type GeneratedType_Locked_issue_event struct { + Node_id string `json:"node_id"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_id string `json:"commit_id"` + Event string `json:"event"` + Url string `json:"url"` + Created_at string `json:"created_at"` + Id int `json:"id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Commit_url string `json:"commit_url"` + Lock_reason string `json:"lock_reason"` +} + +// GeneratedType_Webhook_projects_v2_item_created represents the GeneratedType_Webhook_projects_v2_item_created schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_created struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_status_update GeneratedType `json:"projects_v2_status_update"` // An status update belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// Workflow represents the Workflow schema from the OpenAPI specification +type Workflow struct { Url string `json:"url"` - Id int `json:"id"` // Unique identifier of the deployment + Created_at string `json:"created_at"` + Name string `json:"name"` + State string `json:"state"` + Deleted_at string `json:"deleted_at,omitempty"` + Html_url string `json:"html_url"` + Path string `json:"path"` + Badge_url string `json:"badge_url"` + Id int `json:"id"` Node_id string `json:"node_id"` - Statuses_url string `json:"statuses_url"` - Transient_environment bool `json:"transient_environment,omitempty"` // Specifies if the given environment is will no longer exist at some point in the future. Default: false. - Environment string `json:"environment"` // Name for the target deployment environment. - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Production_environment bool `json:"production_environment,omitempty"` // Specifies if the given environment is one that end-users directly interact with. Default: false. - Repository_url string `json:"repository_url"` - Description string `json:"description"` - Original_environment string `json:"original_environment,omitempty"` Updated_at string `json:"updated_at"` - Created_at string `json:"created_at"` - Task string `json:"task"` // Parameter to specify a task to execute -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes Webhooksprojectchanges `json:"changes"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Version string `json:"version,omitempty"` - Change_status map[string]interface{} `json:"change_status,omitempty"` - Committed_at string `json:"committed_at,omitempty"` - Url string `json:"url,omitempty"` - User GeneratedType `json:"user,omitempty"` // A GitHub user. +// GeneratedType_Code_scanning_default_setup_update represents the GeneratedType_Code_scanning_default_setup_update schema from the OpenAPI specification +type GeneratedType_Code_scanning_default_setup_update struct { + State string `json:"state,omitempty"` // The desired state of code scanning default setup. + Threat_model string `json:"threat_model,omitempty"` // Threat model to be used for code scanning analysis. Use `remote` to analyze only network sources and `remote_and_local` to include local sources like filesystem access, command-line arguments, database reads, environment variable and standard input. + Languages []string `json:"languages,omitempty"` // CodeQL languages to be analyzed. + Query_suite string `json:"query_suite,omitempty"` // CodeQL query suite to be used. + Runner_label string `json:"runner_label,omitempty"` // Runner label to be used if the runner type is labeled. + Runner_type string `json:"runner_type,omitempty"` // Runner type to be used. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Previous_marketplace_purchase Webhookspreviousmarketplacepurchase `json:"previous_marketplace_purchase,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Effective_date string `json:"effective_date"` - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_project_card_created represents the GeneratedType_Webhook_project_card_created schema from the OpenAPI specification +type GeneratedType_Webhook_project_card_created struct { Action string `json:"action"` - Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_card Webhooksprojectcard `json:"project_card"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Alert Webhooksalert `json:"alert"` // The security alert of the vulnerable dependency. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Code_scanning_alert_location represents the GeneratedType_Code_scanning_alert_location schema from the OpenAPI specification +type GeneratedType_Code_scanning_alert_location struct { + End_line int `json:"end_line,omitempty"` + Path string `json:"path,omitempty"` + Start_column int `json:"start_column,omitempty"` + Start_line int `json:"start_line,omitempty"` + End_column int `json:"end_column,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Status string `json:"status"` +// GeneratedType_Labeled_issue_event represents the GeneratedType_Labeled_issue_event schema from the OpenAPI specification +type GeneratedType_Labeled_issue_event struct { + Node_id string `json:"node_id"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_url string `json:"commit_url"` + Created_at string `json:"created_at"` + Id int `json:"id"` + Label map[string]interface{} `json:"label"` + Commit_id string `json:"commit_id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. Url string `json:"url"` + Event string `json:"event"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Thread map[string]interface{} `json:"thread"` - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Page_build represents the GeneratedType_Page_build schema from the OpenAPI specification +type GeneratedType_Page_build struct { + Updated_at string `json:"updated_at"` + Url string `json:"url"` + Commit string `json:"commit"` + Created_at string `json:"created_at"` + Duration int `json:"duration"` + ErrorField map[string]interface{} `json:"error"` + Pusher GeneratedType_Nullable_simple_user `json:"pusher"` // A GitHub user. + Status string `json:"status"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Preferences map[string]interface{} `json:"preferences"` - Repository GeneratedType `json:"repository"` // Minimal Repository +// GeneratedType_Webhook_secret_scanning_alert_location_created represents the GeneratedType_Webhook_secret_scanning_alert_location_created schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_location_created struct { + Action string `json:"action,omitempty"` + Alert GeneratedType_Secret_scanning_alert_webhook `json:"alert"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Location GeneratedType_Secret_scanning_location `json:"location"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - TypeField GeneratedType `json:"type"` // The type of issue. +// GeneratedType_Webhook_discussion_transferred represents the GeneratedType_Webhook_discussion_transferred schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_transferred struct { Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Changes map[string]interface{} `json:"changes"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Label Webhookslabel `json:"label"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` // The changes to the label if the action was `edited`. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Personal_access_token_request represents the GeneratedType_Personal_access_token_request schema from the OpenAPI specification +type GeneratedType_Personal_access_token_request struct { + Permissions_added map[string]interface{} `json:"permissions_added"` // New requested permissions, categorized by type of permission. + Repository_count int `json:"repository_count"` // The number of repositories the token is requesting access to. This field is only populated when `repository_selection` is `subset`. + Token_expired bool `json:"token_expired"` // Whether the associated fine-grained personal access token has expired. + Created_at string `json:"created_at"` // Date and time when the request for access was created. + Repositories []map[string]interface{} `json:"repositories"` // An array of repository objects the token is requesting access to. This field is only populated when `repository_selection` is `subset`. + Token_expires_at string `json:"token_expires_at"` // Date and time when the associated fine-grained personal access token expires. + Token_last_used_at string `json:"token_last_used_at"` // Date and time when the associated fine-grained personal access token was last used for authentication. + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Token_name string `json:"token_name"` // The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. + Permissions_result map[string]interface{} `json:"permissions_result"` // Permissions requested, categorized by type of permission. This field incorporates `permissions_added` and `permissions_upgraded`. + Permissions_upgraded map[string]interface{} `json:"permissions_upgraded"` // Requested permissions that elevate access for a previously approved request for access, categorized by type of permission. + Repository_selection string `json:"repository_selection"` // Type of repository selection requested. + Token_id int `json:"token_id"` // Unique identifier of the user's token. This field can also be found in audit log events and the organization's settings for their PAT grants. + Id int `json:"id"` // Unique identifier of the request for access via fine-grained personal access token. Used as the `pat_request_id` parameter in the list and review API calls. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Errors []map[string]interface{} `json:"errors,omitempty"` - Message string `json:"message"` +// GeneratedType_Validation_error_simple represents the GeneratedType_Validation_error_simple schema from the OpenAPI specification +type GeneratedType_Validation_error_simple struct { Documentation_url string `json:"documentation_url"` + Errors []string `json:"errors,omitempty"` + Message string `json:"message"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Mergeable_state string `json:"mergeable_state"` - Assignees []GeneratedType `json:"assignees,omitempty"` - Changed_files int `json:"changed_files"` - Base map[string]interface{} `json:"base"` - Review_comments int `json:"review_comments"` - Title string `json:"title"` // The title of the pull request. - Merge_commit_sha string `json:"merge_commit_sha"` - Auto_merge GeneratedType `json:"auto_merge"` // The status of auto merging a pull request. - Review_comments_url string `json:"review_comments_url"` - Comments_url string `json:"comments_url"` - Milestone GeneratedType `json:"milestone"` // A collection of related issues and pull requests. - Html_url string `json:"html_url"` - Draft bool `json:"draft,omitempty"` // Indicates whether or not the pull request is a draft. - Head map[string]interface{} `json:"head"` - Id int64 `json:"id"` - Merged_at string `json:"merged_at"` - Review_comment_url string `json:"review_comment_url"` - Updated_at string `json:"updated_at"` - Url string `json:"url"` - Additions int `json:"additions"` - Locked bool `json:"locked"` - Labels []map[string]interface{} `json:"labels"` - Node_id string `json:"node_id"` - Commits int `json:"commits"` - Patch_url string `json:"patch_url"` - Requested_teams []GeneratedType `json:"requested_teams,omitempty"` - Comments int `json:"comments"` - Deletions int `json:"deletions"` - Number int `json:"number"` // Number uniquely identifying the pull request within its repository. - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Closed_at string `json:"closed_at"` - Created_at string `json:"created_at"` - Active_lock_reason string `json:"active_lock_reason,omitempty"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Maintainer_can_modify bool `json:"maintainer_can_modify"` // Indicates whether maintainers can modify the pull request. - State string `json:"state"` // State of this Pull Request. Either `open` or `closed`. - Statuses_url string `json:"statuses_url"` - Body string `json:"body"` - Merged_by GeneratedType `json:"merged_by"` // A GitHub user. - Commits_url string `json:"commits_url"` - Rebaseable bool `json:"rebaseable,omitempty"` - Issue_url string `json:"issue_url"` - Requested_reviewers []GeneratedType `json:"requested_reviewers,omitempty"` - User GeneratedType `json:"user"` // A GitHub user. - Links map[string]interface{} `json:"_links"` - Merged bool `json:"merged"` - Diff_url string `json:"diff_url"` - Mergeable bool `json:"mergeable"` +// GeneratedType_Webhook_repository_import represents the GeneratedType_Webhook_repository_import schema from the OpenAPI specification +type GeneratedType_Webhook_repository_import struct { + Status string `json:"status"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } // Actor represents the Actor schema from the OpenAPI specification type Actor struct { - Id int `json:"id"` - Login string `json:"login"` Url string `json:"url"` Avatar_url string `json:"avatar_url"` Display_login string `json:"display_login,omitempty"` Gravatar_id string `json:"gravatar_id"` + Id int `json:"id"` + Login string `json:"login"` } -// Topic represents the Topic schema from the OpenAPI specification -type Topic struct { - Names []string `json:"names"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Expires_at string `json:"expires_at"` - Limit string `json:"limit"` // The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. - Origin string `json:"origin"` +// GeneratedType_Repository_rule_commit_message_pattern represents the GeneratedType_Repository_rule_commit_message_pattern schema from the OpenAPI specification +type GeneratedType_Repository_rule_commit_message_pattern struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_team_edited represents the GeneratedType_Webhook_team_edited schema from the OpenAPI specification +type GeneratedType_Webhook_team_edited struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository map[string]interface{} `json:"repository,omitempty"` // A git repository + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_card map[string]interface{} `json:"project_card"` + Changes map[string]interface{} `json:"changes"` // The changes to the team if the action was `edited`. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_custom_property_values_updated represents the GeneratedType_Webhook_custom_property_values_updated schema from the OpenAPI specification +type GeneratedType_Webhook_custom_property_values_updated struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Comment map[string]interface{} `json:"comment"` // The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request_url string `json:"pull_request_url"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Body string `json:"body"` // The text of the review. - Node_id string `json:"node_id"` - User GeneratedType `json:"user"` // A GitHub user. - Body_text string `json:"body_text,omitempty"` - Event string `json:"event"` - Html_url string `json:"html_url"` - State string `json:"state"` - Submitted_at string `json:"submitted_at,omitempty"` - Links map[string]interface{} `json:"_links"` - Body_html string `json:"body_html,omitempty"` - Commit_id string `json:"commit_id"` // A commit SHA for the review. - Id int `json:"id"` // Unique identifier of the review + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + New_property_values []GeneratedType_Custom_property_value `json:"new_property_values"` // The new custom property values for the repository. + Old_property_values []GeneratedType_Custom_property_value `json:"old_property_values"` // The old custom property values for the repository. + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_release_unpublished represents the GeneratedType_Webhook_release_unpublished schema from the OpenAPI specification +type GeneratedType_Webhook_release_unpublished struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Invitation map[string]interface{} `json:"invitation"` // The invitation for the user or email if the action is `member_invited`. - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - User Webhooksuser `json:"user,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Release Webhooksrelease1 `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Body_html string `json:"body_html,omitempty"` +// GeneratedType_Gist_comment represents the GeneratedType_Gist_comment schema from the OpenAPI specification +type GeneratedType_Gist_comment struct { + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Author_association string `json:"author_association"` // How the author is associated with the repository. + Body string `json:"body"` // The comment text. Created_at string `json:"created_at"` - Reactions GeneratedType `json:"reactions,omitempty"` - Html_url string `json:"html_url"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Url string `json:"url"` // URL for the issue comment - Body_text string `json:"body_text,omitempty"` - Issue_url string `json:"issue_url"` + Id int `json:"id"` Node_id string `json:"node_id"` - Body string `json:"body,omitempty"` // Contents of the issue comment - Id int64 `json:"id"` // Unique identifier of the issue comment Updated_at string `json:"updated_at"` - User GeneratedType `json:"user"` // A GitHub user. - Author_association string `json:"author_association"` // How the author is associated with the repository. + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Event string `json:"event,omitempty"` - Node_id string `json:"node_id,omitempty"` - Comments []GeneratedType `json:"comments,omitempty"` +// GeneratedType_Copilot_dotcom_pull_requests represents the GeneratedType_Copilot_dotcom_pull_requests schema from the OpenAPI specification +type GeneratedType_Copilot_dotcom_pull_requests struct { + Total_engaged_users int `json:"total_engaged_users,omitempty"` // The number of users who used Copilot for Pull Requests on github.com to generate a pull request summary at least once. + Repositories []map[string]interface{} `json:"repositories,omitempty"` // Repositories in which users used Copilot for Pull Requests to generate pull request summaries } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Models []map[string]interface{} `json:"models,omitempty"` // List of model metrics for a custom models and the default model. - Total_engaged_users int `json:"total_engaged_users,omitempty"` // Total number of users who prompted Copilot Chat on github.com at least once. +// GeneratedType_Webhook_dependabot_alert_reintroduced represents the GeneratedType_Webhook_dependabot_alert_reintroduced schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_reintroduced struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` +// GeneratedType_License_content represents the GeneratedType_License_content schema from the OpenAPI specification +type GeneratedType_License_content struct { + Name string `json:"name"` + Size int `json:"size"` + Path string `json:"path"` + Url string `json:"url"` + Content string `json:"content"` + Git_url string `json:"git_url"` + Html_url string `json:"html_url"` + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Sha string `json:"sha"` TypeField string `json:"type"` + Links map[string]interface{} `json:"_links"` + Download_url string `json:"download_url"` + Encoding string `json:"encoding"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` // The changes to the milestone if the action was `edited`. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Action string `json:"action"` - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. - Sub_issue_repo Repository `json:"sub_issue_repo"` // A repository on GitHub. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. +// GeneratedType_Timeline_issue_events represents the GeneratedType_Timeline_issue_events schema from the OpenAPI specification +type GeneratedType_Timeline_issue_events struct { } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Ref_name map[string]interface{} `json:"ref_name,omitempty"` +// GeneratedType_Projects_v2_iteration_setting represents the GeneratedType_Projects_v2_iteration_setting schema from the OpenAPI specification +type GeneratedType_Projects_v2_iteration_setting struct { + Duration float64 `json:"duration,omitempty"` + Id string `json:"id"` + Start_date string `json:"start_date,omitempty"` + Title string `json:"title"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sha string `json:"sha,omitempty"` // SHA of commit with autofix. - Target_ref string `json:"target_ref,omitempty"` // The Git reference of target branch for the commit. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation. +// GeneratedType_Secret_scanning_location_issue_title represents the GeneratedType_Secret_scanning_location_issue_title schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_issue_title struct { + Issue_title_url string `json:"issue_title_url"` // The API URL to get the issue where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` // Whether it's a Group Assignment or Individual Assignment. - Public_repo bool `json:"public_repo"` // Whether an accepted assignment creates a public repository. - Slug string `json:"slug"` // Sluggified name of the assignment. - Feedback_pull_requests_enabled bool `json:"feedback_pull_requests_enabled"` // Whether feedback pull request will be created on assignment acceptance. - Invitations_enabled bool `json:"invitations_enabled"` // Whether the invitation link is enabled. Visiting an enabled invitation link will accept the assignment. - Submitted int `json:"submitted"` // The number of students that have submitted the assignment. - Max_members int `json:"max_members,omitempty"` // The maximum allowable members per team. - Students_are_repo_admins bool `json:"students_are_repo_admins"` // Whether students are admins on created repository on accepted assignment. - Language string `json:"language"` // The programming language used in the assignment. - Title string `json:"title"` // Assignment title. - Invite_link string `json:"invite_link"` // The link that a student can use to accept the assignment. - Classroom GeneratedType `json:"classroom"` // A GitHub Classroom classroom - Id int `json:"id"` // Unique identifier of the repository. - Max_teams int `json:"max_teams,omitempty"` // The maximum allowable teams for the assignment. - Passing int `json:"passing"` // The number of students that have passed the assignment. - Accepted int `json:"accepted"` // The number of students that have accepted the assignment. - Deadline string `json:"deadline"` // The time at which the assignment is due. - Editor string `json:"editor"` // The selected editor for the assignment. +// GeneratedType_Webhook_check_run_completed_form_encoded represents the GeneratedType_Webhook_check_run_completed_form_encoded schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_completed_form_encoded struct { + Payload string `json:"payload"` // A URL-encoded string of the check_run.completed JSON payload. The decoded payload is a JSON object. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_security_advisory_withdrawn represents the GeneratedType_Webhook_security_advisory_withdrawn schema from the OpenAPI specification +type GeneratedType_Webhook_security_advisory_withdrawn struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Single_file string `json:"single_file,omitempty"` - Token string `json:"token"` // The token used for authentication - Expires_at string `json:"expires_at"` // The time this token expires - Permissions map[string]interface{} `json:"permissions,omitempty"` - Repositories []Repository `json:"repositories,omitempty"` // The repositories this token has access to - Repository_selection string `json:"repository_selection,omitempty"` // Describe whether all repositories have been selected or there's a selection involved -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Score float64 `json:"score"` - Sha string `json:"sha"` - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` - Git_url string `json:"git_url"` - Path string `json:"path"` - Repository GeneratedType `json:"repository"` // Minimal Repository - File_size int `json:"file_size,omitempty"` - Language string `json:"language,omitempty"` - Last_modified_at string `json:"last_modified_at,omitempty"` - Name string `json:"name"` - Html_url string `json:"html_url"` - Url string `json:"url"` - Line_numbers []string `json:"line_numbers,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Security_advisory map[string]interface{} `json:"security_advisory"` // The details of the security advisory, including summary, description, and severity. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request Webhookspullrequest5 `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_issues_untyped represents the GeneratedType_Webhook_issues_untyped schema from the OpenAPI specification +type GeneratedType_Webhook_issues_untyped struct { + Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + TypeField GeneratedType_Issue_type `json:"type"` // The type of issue. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Milestone Milestone `json:"milestone,omitempty"` // A collection of related issues and pull requests. - Number int `json:"number"` // The pull request number. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request GeneratedType `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_projects_v2_item_deleted represents the GeneratedType_Webhook_projects_v2_item_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_deleted struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository map[string]interface{} `json:"repository,omitempty"` // A git repository - Sender GeneratedType `json:"sender"` // A GitHub user. - Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Nullable_git_user represents the GeneratedType_Nullable_git_user schema from the OpenAPI specification +type GeneratedType_Nullable_git_user struct { + Date string `json:"date,omitempty"` + Email string `json:"email,omitempty"` + Name string `json:"name,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Source_type string `json:"source_type,omitempty"` // The source type of the property - Url string `json:"url,omitempty"` // The URL that can be used to fetch, update, or delete info about this property via the API. - Description string `json:"description,omitempty"` // Short description of the property - Property_name string `json:"property_name"` // The name of the property - Value_type string `json:"value_type"` // The type of the value for the property - Values_editable_by string `json:"values_editable_by,omitempty"` // Who can edit the values of the property - Allowed_values []string `json:"allowed_values,omitempty"` // An ordered list of the allowed values of the property. The property can have up to 200 allowed values. - Default_value string `json:"default_value,omitempty"` // Default value of the property - Required bool `json:"required,omitempty"` // Whether the property is required. +// GeneratedType_Repository_rule_code_scanning represents the GeneratedType_Repository_rule_code_scanning schema from the OpenAPI specification +type GeneratedType_Repository_rule_code_scanning struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_id string `json:"commit_id"` - Created_at string `json:"created_at"` - Node_id string `json:"node_id"` - Requested_reviewer GeneratedType `json:"requested_reviewer,omitempty"` // A GitHub user. - Actor GeneratedType `json:"actor"` // A GitHub user. - Commit_url string `json:"commit_url"` - Event string `json:"event"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Requested_team Team `json:"requested_team,omitempty"` // Groups of organization members that gives permissions on specified repositories. - Review_requester GeneratedType `json:"review_requester"` // A GitHub user. - Url string `json:"url"` - Id int `json:"id"` +// GeneratedType_Actions_workflow_access_to_repository represents the GeneratedType_Actions_workflow_access_to_repository schema from the OpenAPI specification +type GeneratedType_Actions_workflow_access_to_repository struct { + Access_level string `json:"access_level"` // Defines the level of access that workflows outside of the repository have to actions and reusable workflows within the repository. `none` means the access is only possible from workflows in this repository. `user` level access allows sharing across user owned private repositories only. `organization` level access allows sharing across the organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int64 `json:"id"` - Name string `json:"name"` - Sync_to_organizations string `json:"sync_to_organizations,omitempty"` +// GeneratedType_Org_private_registry_configuration_with_selected_repositories represents the GeneratedType_Org_private_registry_configuration_with_selected_repositories schema from the OpenAPI specification +type GeneratedType_Org_private_registry_configuration_with_selected_repositories struct { + Selected_repository_ids []int `json:"selected_repository_ids,omitempty"` // An array of repository IDs that can access the organization private registry when `visibility` is set to `selected`. Updated_at string `json:"updated_at"` - Url string `json:"url"` - Description string `json:"description,omitempty"` - Group_id string `json:"group_id,omitempty"` - Slug string `json:"slug"` + Username string `json:"username,omitempty"` // The username to use when authenticating with the private registry. + Visibility string `json:"visibility"` // Which type of organization repositories have access to the private registry. `selected` means only the repositories specified by `selected_repository_ids` can access the private registry. Created_at string `json:"created_at"` - Group_name string `json:"group_name,omitempty"` - Html_url string `json:"html_url"` - Members_url string `json:"members_url"` - Organization_selection_type string `json:"organization_selection_type,omitempty"` + Name string `json:"name"` // The name of the private registry configuration. + Registry_type string `json:"registry_type"` // The registry type. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Network_configuration_id string `json:"network_configuration_id,omitempty"` // The identifier of the network configuration that is using this settings resource. - Region string `json:"region"` // The location of the subnet this network settings resource is configured for. - Subnet_id string `json:"subnet_id"` // The subnet this network settings resource is configured for. - Id string `json:"id"` // The unique identifier of the network settings resource. - Name string `json:"name"` // The name of the network settings resource. +// GeneratedType_Cvss_severities represents the GeneratedType_Cvss_severities schema from the OpenAPI specification +type GeneratedType_Cvss_severities struct { + Cvss_v4 map[string]interface{} `json:"cvss_v4,omitempty"` + Cvss_v3 map[string]interface{} `json:"cvss_v3,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url"` - Url string `json:"url"` +// GeneratedType_Webhook_merge_group_checks_requested represents the GeneratedType_Webhook_merge_group_checks_requested schema from the OpenAPI specification +type GeneratedType_Webhook_merge_group_checks_requested struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Merge_group GeneratedType_Merge_group `json:"merge_group"` // A group of pull requests that the merge queue has grouped together to be merged. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sha string `json:"sha"` +// GeneratedType_Combined_commit_status represents the GeneratedType_Combined_commit_status schema from the OpenAPI specification +type GeneratedType_Combined_commit_status struct { Url string `json:"url"` + Commit_url string `json:"commit_url"` + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + Sha string `json:"sha"` + State string `json:"state"` + Statuses []GeneratedType_Simple_commit_status `json:"statuses"` + Total_count int `json:"total_count"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_card Webhooksprojectcard `json:"project_card"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_repository_ruleset_deleted represents the GeneratedType_Webhook_repository_ruleset_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_repository_ruleset_deleted struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Repository_ruleset GeneratedType_Repository_ruleset `json:"repository_ruleset"` // A set of rules to apply when specified conditions are met. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url"` // The REST API URL of the alert resource. - Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Fixed_at string `json:"fixed_at"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. +// GeneratedType_Code_scanning_alert_items represents the GeneratedType_Code_scanning_alert_items schema from the OpenAPI specification +type GeneratedType_Code_scanning_alert_items struct { + State string `json:"state"` // State of a code scanning alert. + Dismissed_by GeneratedType_Nullable_simple_user `json:"dismissed_by"` // A GitHub user. + Number int `json:"number"` // The security alert number. Html_url string `json:"html_url"` // The GitHub URL of the alert resource. + Dismissed_comment string `json:"dismissed_comment,omitempty"` // The dismissal comment associated with the dismissal of the alert. + Instances_url string `json:"instances_url"` // The REST API URL for fetching the list of instances for an alert. + Rule GeneratedType_Code_scanning_alert_rule_summary `json:"rule"` + Most_recent_instance GeneratedType_Code_scanning_alert_instance `json:"most_recent_instance"` + Tool GeneratedType_Code_scanning_analysis_tool `json:"tool"` + Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Url string `json:"url"` // The REST API URL of the alert resource. + Dismissal_approved_by GeneratedType_Nullable_simple_user `json:"dismissal_approved_by,omitempty"` // A GitHub user. Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Dismissed_comment string `json:"dismissed_comment"` // An optional comment associated with the alert's dismissal. - Dismissed_reason string `json:"dismissed_reason"` // The reason that the alert was dismissed. - Number int `json:"number"` // The security alert number. - State string `json:"state"` // The state of the Dependabot alert. - Auto_dismissed_at string `json:"auto_dismissed_at,omitempty"` // The time that the alert was auto-dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Dismissed_by GeneratedType `json:"dismissed_by"` // A GitHub user. - Dependency map[string]interface{} `json:"dependency"` // Details for the vulnerable dependency. - Security_vulnerability GeneratedType `json:"security_vulnerability"` // Details pertaining to one vulnerable version range for the advisory. - Security_advisory GeneratedType `json:"security_advisory"` // Details for the GitHub Security Advisory. - Repository GeneratedType `json:"repository"` // A GitHub repository. - Updated_at string `json:"updated_at"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_reason string `json:"dismissed_reason"` // **Required when the state is dismissed.** The reason for dismissing or closing the alert. + Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Fixed_at string `json:"fixed_at,omitempty"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actions_caches []map[string]interface{} `json:"actions_caches"` // Array of caches - Total_count int `json:"total_count"` // Total number of caches +// GeneratedType_Page_deployment represents the GeneratedType_Page_deployment schema from the OpenAPI specification +type GeneratedType_Page_deployment struct { + Id string `json:"id"` // The ID of the GitHub Pages deployment. This is the Git SHA of the deployed commit. + Page_url string `json:"page_url"` // The URI to the deployed GitHub Pages. + Preview_url string `json:"preview_url,omitempty"` // The URI to the deployed GitHub Pages preview. + Status_url string `json:"status_url"` // The URI to monitor GitHub Pages deployment status. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Contributors_url string `json:"contributors_url"` - Deployments_url string `json:"deployments_url"` - Trees_url string `json:"trees_url"` - Teams_url string `json:"teams_url"` - Is_template bool `json:"is_template,omitempty"` - Open_issues int `json:"open_issues,omitempty"` - Notifications_url string `json:"notifications_url"` - Private bool `json:"private"` - Code_of_conduct GeneratedType `json:"code_of_conduct,omitempty"` // Code Of Conduct - Pushed_at string `json:"pushed_at,omitempty"` - Html_url string `json:"html_url"` - Downloads_url string `json:"downloads_url"` +// GeneratedType_Code_scanning_autofix represents the GeneratedType_Code_scanning_autofix schema from the OpenAPI specification +type GeneratedType_Code_scanning_autofix struct { + Description string `json:"description"` // The description of an autofix. + Started_at string `json:"started_at"` // The start time of an autofix in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Status string `json:"status"` // The status of an autofix. +} + +// Commit represents the Commit schema from the OpenAPI specification +type Commit struct { + Committer interface{} `json:"committer"` Node_id string `json:"node_id"` - Git_url string `json:"git_url,omitempty"` - Has_issues bool `json:"has_issues,omitempty"` - Topics []string `json:"topics,omitempty"` - Forks_url string `json:"forks_url"` - Subscribers_count int `json:"subscribers_count,omitempty"` - Forks_count int `json:"forks_count,omitempty"` - Name string `json:"name"` - Contents_url string `json:"contents_url"` - Issue_comment_url string `json:"issue_comment_url"` - Milestones_url string `json:"milestones_url"` - Forks int `json:"forks,omitempty"` - Git_tags_url string `json:"git_tags_url"` - Full_name string `json:"full_name"` - Releases_url string `json:"releases_url"` - Owner GeneratedType `json:"owner"` // A GitHub user. - Tags_url string `json:"tags_url"` - Created_at string `json:"created_at,omitempty"` - Commits_url string `json:"commits_url"` - Updated_at string `json:"updated_at,omitempty"` - Blobs_url string `json:"blobs_url"` - Languages_url string `json:"languages_url"` - Archive_url string `json:"archive_url"` - Subscription_url string `json:"subscription_url"` - License map[string]interface{} `json:"license,omitempty"` - Has_downloads bool `json:"has_downloads,omitempty"` - Has_wiki bool `json:"has_wiki,omitempty"` + Sha string `json:"sha"` + Stats map[string]interface{} `json:"stats,omitempty"` + Files []GeneratedType_Diff_entry `json:"files,omitempty"` Url string `json:"url"` - Default_branch string `json:"default_branch,omitempty"` - Archived bool `json:"archived,omitempty"` - Has_pages bool `json:"has_pages,omitempty"` - Git_refs_url string `json:"git_refs_url"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Stargazers_count int `json:"stargazers_count,omitempty"` - Id int64 `json:"id"` - Labels_url string `json:"labels_url"` - Homepage string `json:"homepage,omitempty"` - Description string `json:"description"` - Statuses_url string `json:"statuses_url"` - Issues_url string `json:"issues_url"` - Network_count int `json:"network_count,omitempty"` - Compare_url string `json:"compare_url"` - Disabled bool `json:"disabled,omitempty"` - Size int `json:"size,omitempty"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Assignees_url string `json:"assignees_url"` - Fork bool `json:"fork"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Author interface{} `json:"author"` Comments_url string `json:"comments_url"` - Watchers int `json:"watchers,omitempty"` - Svn_url string `json:"svn_url,omitempty"` - Pulls_url string `json:"pulls_url"` - Open_issues_count int `json:"open_issues_count,omitempty"` - Mirror_url string `json:"mirror_url,omitempty"` - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` - Watchers_count int `json:"watchers_count,omitempty"` - Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. - Clone_url string `json:"clone_url,omitempty"` - Git_commits_url string `json:"git_commits_url"` - Allow_forking bool `json:"allow_forking,omitempty"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Keys_url string `json:"keys_url"` - Events_url string `json:"events_url"` - Has_projects bool `json:"has_projects,omitempty"` - Has_discussions bool `json:"has_discussions,omitempty"` - Security_and_analysis GeneratedType `json:"security_and_analysis,omitempty"` - Stargazers_url string `json:"stargazers_url"` - Role_name string `json:"role_name,omitempty"` - Subscribers_url string `json:"subscribers_url"` - Visibility string `json:"visibility,omitempty"` - Collaborators_url string `json:"collaborators_url"` - Merges_url string `json:"merges_url"` - Ssh_url string `json:"ssh_url,omitempty"` - Issue_events_url string `json:"issue_events_url"` - Branches_url string `json:"branches_url"` - Language string `json:"language,omitempty"` - Hooks_url string `json:"hooks_url"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Number int `json:"number"` // The pull request number. - Before string `json:"before"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Sender GeneratedType `json:"sender"` // A GitHub user. - After string `json:"after"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` + Commit map[string]interface{} `json:"commit"` + Parents []map[string]interface{} `json:"parents"` + Html_url string `json:"html_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actor GeneratedType `json:"actor"` // A GitHub user. - Event string `json:"event"` - Url string `json:"url"` - Commit_id string `json:"commit_id"` - Commit_url string `json:"commit_url"` - Created_at string `json:"created_at"` - Id int `json:"id"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Label map[string]interface{} `json:"label"` - Node_id string `json:"node_id"` +// GeneratedType_Org_ruleset_conditions represents the GeneratedType_Org_ruleset_conditions schema from the OpenAPI specification +type GeneratedType_Org_ruleset_conditions struct { } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_id int `json:"repository_id"` - Repository_name string `json:"repository_name"` - Properties []GeneratedType `json:"properties"` // List of custom property names and associated values - Repository_full_name string `json:"repository_full_name"` +// GeneratedType_Secret_scanning_location_pull_request_body represents the GeneratedType_Secret_scanning_location_pull_request_body schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_pull_request_body struct { + Pull_request_body_url string `json:"pull_request_body_url"` // The API URL to get the pull request where the secret was detected. } -// Metadata represents the Metadata schema from the OpenAPI specification -type Metadata struct { +// GeneratedType_Webhook_team_removed_from_repository represents the GeneratedType_Webhook_team_removed_from_repository schema from the OpenAPI specification +type GeneratedType_Webhook_team_removed_from_repository struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository map[string]interface{} `json:"repository,omitempty"` // A git repository + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_issues_pinned represents the GeneratedType_Webhook_issues_pinned schema from the OpenAPI specification +type GeneratedType_Webhook_issues_pinned struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue Webhooksissue2 `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// Classroom represents the Classroom schema from the OpenAPI specification -type Classroom struct { - Id int `json:"id"` // Unique identifier of the classroom. - Name string `json:"name"` // The name of the classroom. - Organization GeneratedType `json:"organization"` // A GitHub organization. - Url string `json:"url"` // The URL of the classroom on GitHub Classroom. - Archived bool `json:"archived"` // Whether classroom is archived. +// Webhooksissue2 represents the Webhooksissue2 schema from the OpenAPI specification +type Webhooksissue2 struct { + Assignees []map[string]interface{} `json:"assignees"` + User map[string]interface{} `json:"user"` + Html_url string `json:"html_url"` + Updated_at string `json:"updated_at"` + Sub_issues_summary map[string]interface{} `json:"sub_issues_summary,omitempty"` + Id int64 `json:"id"` + Labels []map[string]interface{} `json:"labels,omitempty"` + Reactions map[string]interface{} `json:"reactions"` + Created_at string `json:"created_at"` + Timeline_url string `json:"timeline_url,omitempty"` + State string `json:"state,omitempty"` // State of the issue; either 'open' or 'closed' + Events_url string `json:"events_url"` + Milestone map[string]interface{} `json:"milestone"` // A collection of related issues and pull requests. + Url string `json:"url"` // URL for the issue + Number int `json:"number"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + Performed_via_github_app map[string]interface{} `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Draft bool `json:"draft,omitempty"` + Node_id string `json:"node_id"` + Closed_at string `json:"closed_at"` + Assignee map[string]interface{} `json:"assignee,omitempty"` + Comments int `json:"comments"` + Title string `json:"title"` // Title of the issue + Locked bool `json:"locked,omitempty"` + TypeField GeneratedType_Issue_type `json:"type,omitempty"` // The type of issue. + State_reason string `json:"state_reason,omitempty"` + Comments_url string `json:"comments_url"` + Active_lock_reason string `json:"active_lock_reason"` + Labels_url string `json:"labels_url"` + Body string `json:"body"` // Contents of the issue + Pull_request map[string]interface{} `json:"pull_request,omitempty"` + Repository_url string `json:"repository_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Included_gigabytes_bandwidth int `json:"included_gigabytes_bandwidth"` // Free storage space (GB) for GitHub Packages. - Total_gigabytes_bandwidth_used int `json:"total_gigabytes_bandwidth_used"` // Sum of the free and paid storage space (GB) for GitHuub Packages. - Total_paid_gigabytes_bandwidth_used int `json:"total_paid_gigabytes_bandwidth_used"` // Total paid storage space (GB) for GitHuub Packages. +// GeneratedType_Security_advisory_epss represents the GeneratedType_Security_advisory_epss schema from the OpenAPI specification +type GeneratedType_Security_advisory_epss struct { + Percentage float64 `json:"percentage,omitempty"` + Percentile float64 `json:"percentile,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Installation GeneratedType `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Changes map[string]interface{} `json:"changes"` - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Target_type string `json:"target_type"` - Account map[string]interface{} `json:"account"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Key_simple represents the GeneratedType_Key_simple schema from the OpenAPI specification +type GeneratedType_Key_simple struct { + Created_at string `json:"created_at,omitempty"` + Id int `json:"id"` + Key string `json:"key"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Discussion_comment_url string `json:"discussion_comment_url"` // The API URL to get the discussion comment where the secret was detected. +// Deployment represents the Deployment schema from the OpenAPI specification +type Deployment struct { + Node_id string `json:"node_id"` + Updated_at string `json:"updated_at"` + Id int64 `json:"id"` // Unique identifier of the deployment + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Repository_url string `json:"repository_url"` + Url string `json:"url"` + Original_environment string `json:"original_environment,omitempty"` + Statuses_url string `json:"statuses_url"` + Payload interface{} `json:"payload"` + Task string `json:"task"` // Parameter to specify a task to execute + Transient_environment bool `json:"transient_environment,omitempty"` // Specifies if the given environment is will no longer exist at some point in the future. Default: false. + Environment string `json:"environment"` // Name for the target deployment environment. + Production_environment bool `json:"production_environment,omitempty"` // Specifies if the given environment is one that end-users directly interact with. Default: false. + Ref string `json:"ref"` // The ref to deploy. This can be a branch, tag, or sha. + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. + Description string `json:"description"` + Sha string `json:"sha"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_star_deleted represents the GeneratedType_Webhook_star_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_star_deleted struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Starred_at interface{} `json:"starred_at"` // The time the star was created. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Will be `null` for the `deleted` action. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Content_type string `json:"content_type,omitempty"` // The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. - Insecure_ssl string `json:"insecure_ssl,omitempty"` - Secret string `json:"secret,omitempty"` // If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers). - Url string `json:"url,omitempty"` // The URL to which the payloads will be delivered. +// GeneratedType_Webhook_issues_labeled represents the GeneratedType_Webhook_issues_labeled schema from the OpenAPI specification +type GeneratedType_Webhook_issues_labeled struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Label Webhookslabel `json:"label,omitempty"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// Webhooksuser represents the Webhooksuser schema from the OpenAPI specification -type Webhooksuser struct { - Email string `json:"email,omitempty"` - Received_events_url string `json:"received_events_url,omitempty"` - Subscriptions_url string `json:"subscriptions_url,omitempty"` - Name string `json:"name,omitempty"` - Followers_url string `json:"followers_url,omitempty"` - Site_admin bool `json:"site_admin,omitempty"` - Id int64 `json:"id"` - Events_url string `json:"events_url,omitempty"` - Html_url string `json:"html_url,omitempty"` - Repos_url string `json:"repos_url,omitempty"` - Avatar_url string `json:"avatar_url,omitempty"` - Following_url string `json:"following_url,omitempty"` - TypeField string `json:"type,omitempty"` - Login string `json:"login"` - Url string `json:"url,omitempty"` - Gists_url string `json:"gists_url,omitempty"` - Gravatar_id string `json:"gravatar_id,omitempty"` - Starred_url string `json:"starred_url,omitempty"` - Organizations_url string `json:"organizations_url,omitempty"` - Deleted bool `json:"deleted,omitempty"` - Node_id string `json:"node_id,omitempty"` - User_view_type string `json:"user_view_type,omitempty"` +// GeneratedType_Organization_programmatic_access_grant_request represents the GeneratedType_Organization_programmatic_access_grant_request schema from the OpenAPI specification +type GeneratedType_Organization_programmatic_access_grant_request struct { + Token_id int `json:"token_id"` // Unique identifier of the user's token. This field can also be found in audit log events and the organization's settings for their PAT grants. + Token_name string `json:"token_name"` // The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Permissions map[string]interface{} `json:"permissions"` // Permissions requested, categorized by type of permission. + Id int `json:"id"` // Unique identifier of the request for access via fine-grained personal access token. The `pat_request_id` used to review PAT requests. + Repositories_url string `json:"repositories_url"` // URL to the list of repositories requested to be accessed via fine-grained personal access token. Should only be followed when `repository_selection` is `subset`. + Repository_selection string `json:"repository_selection"` // Type of repository selection requested. + Token_expired bool `json:"token_expired"` // Whether the associated fine-grained personal access token has expired. + Reason string `json:"reason"` // Reason for requesting access. + Token_last_used_at string `json:"token_last_used_at"` // Date and time when the associated fine-grained personal access token was last used for authentication. + Created_at string `json:"created_at"` // Date and time when the request for access was created. + Token_expires_at string `json:"token_expires_at"` // Date and time when the associated fine-grained personal access token expires. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_requests []GeneratedType `json:"pull_requests,omitempty"` - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Action string `json:"action,omitempty"` - Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed - Event string `json:"event,omitempty"` // The event that triggered the deployment protection rule. - Deployment_callback_url string `json:"deployment_callback_url,omitempty"` // The URL to review the deployment protection rule. - Environment string `json:"environment,omitempty"` // The name of the environment that has the deployment protection rule. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Nullable_team_simple represents the GeneratedType_Nullable_team_simple schema from the OpenAPI specification +type GeneratedType_Nullable_team_simple struct { + Repositories_url string `json:"repositories_url"` + Url string `json:"url"` // URL for the team + Name string `json:"name"` // Name of the team + Node_id string `json:"node_id"` + Privacy string `json:"privacy,omitempty"` // The level of privacy this team should have + Description string `json:"description"` // Description of the team + Html_url string `json:"html_url"` + Id int `json:"id"` // Unique identifier of the team + Members_url string `json:"members_url"` + Permission string `json:"permission"` // Permission that the team will have for its repositories + Ldap_dn string `json:"ldap_dn,omitempty"` // Distinguished Name (DN) that team maps to within LDAP environment + Notification_setting string `json:"notification_setting,omitempty"` // The notification setting the team has set + Slug string `json:"slug"` } -// Webhooksprojectchanges represents the Webhooksprojectchanges schema from the OpenAPI specification -type Webhooksprojectchanges struct { - Archived_at map[string]interface{} `json:"archived_at,omitempty"` +// GeneratedType_Secret_scanning_location_discussion_comment represents the GeneratedType_Secret_scanning_location_discussion_comment schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_discussion_comment struct { + Discussion_comment_url string `json:"discussion_comment_url"` // The API URL to get the discussion comment where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Webhook_issue_comment_deleted represents the GeneratedType_Webhook_issue_comment_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_issue_comment_deleted struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Comment Webhooksissuecomment `json:"comment"` // The [comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) the comment belongs to. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// Hook represents the Hook schema from the OpenAPI specification +type Hook struct { Updated_at string `json:"updated_at"` - Client_id string `json:"client_id,omitempty"` + Last_response GeneratedType_Hook_response `json:"last_response"` + Url string `json:"url"` + Events []string `json:"events"` // Determines what events the hook is triggered for. Default: ['push']. + Config GeneratedType_Webhook_config `json:"config"` // Configuration object of the webhook + Id int `json:"id"` // Unique identifier of the webhook. + Ping_url string `json:"ping_url"` + Active bool `json:"active"` // Determines whether the hook is actually triggered on pushes. Created_at string `json:"created_at"` - Html_url string `json:"html_url"` - Node_id string `json:"node_id"` - Installations_count int `json:"installations_count,omitempty"` // The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself. - Owner interface{} `json:"owner"` - Permissions map[string]interface{} `json:"permissions"` // The set of permissions for the GitHub app - Slug string `json:"slug,omitempty"` // The slug name of the GitHub app - Description string `json:"description"` - External_url string `json:"external_url"` - Id int `json:"id"` // Unique identifier of the GitHub app - Name string `json:"name"` // The name of the GitHub app - Events []string `json:"events"` // The list of events for the GitHub app. Note that the `installation_target`, `security_advisory`, and `meta` events are not included because they are global events and not specific to an installation. + Deliveries_url string `json:"deliveries_url,omitempty"` + Name string `json:"name"` // The name of a valid service, use 'web' for a webhook. + Test_url string `json:"test_url"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue_body_url string `json:"issue_body_url"` // The API URL to get the issue where the secret was detected. +// GeneratedType_Network_configuration represents the GeneratedType_Network_configuration schema from the OpenAPI specification +type GeneratedType_Network_configuration struct { + Compute_service string `json:"compute_service,omitempty"` // The hosted compute service the network configuration supports. + Created_on string `json:"created_on"` // The time at which the network configuration was created, in ISO 8601 format. + Id string `json:"id"` // The unique identifier of the network configuration. + Name string `json:"name"` // The name of the network configuration. + Network_settings_ids []string `json:"network_settings_ids,omitempty"` // The unique identifier of each network settings in the configuration. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Site_admin bool `json:"site_admin"` +// Webhooksissue represents the Webhooksissue schema from the OpenAPI specification +type Webhooksissue struct { + Locked bool `json:"locked,omitempty"` Node_id string `json:"node_id"` - Avatar_url string `json:"avatar_url"` + Comments_url string `json:"comments_url"` + Pull_request map[string]interface{} `json:"pull_request,omitempty"` + Updated_at string `json:"updated_at"` + Reactions map[string]interface{} `json:"reactions"` + TypeField GeneratedType_Issue_type `json:"type,omitempty"` // The type of issue. + Draft bool `json:"draft,omitempty"` + Performed_via_github_app map[string]interface{} `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Number int `json:"number"` + Timeline_url string `json:"timeline_url,omitempty"` + Created_at string `json:"created_at"` + State_reason string `json:"state_reason,omitempty"` + Milestone map[string]interface{} `json:"milestone"` // A collection of related issues and pull requests. + User map[string]interface{} `json:"user"` + Repository_url string `json:"repository_url"` + Labels []map[string]interface{} `json:"labels,omitempty"` + State string `json:"state,omitempty"` // State of the issue; either 'open' or 'closed' + Comments int `json:"comments"` + Url string `json:"url"` // URL for the issue + Author_association string `json:"author_association"` // How the author is associated with the repository. + Labels_url string `json:"labels_url"` Html_url string `json:"html_url"` - Starred_at string `json:"starred_at,omitempty"` - Starred_url string `json:"starred_url"` - Followers_url string `json:"followers_url"` - Subscriptions_url string `json:"subscriptions_url"` - User_view_type string `json:"user_view_type,omitempty"` - Login string `json:"login"` - Received_events_url string `json:"received_events_url"` - TypeField string `json:"type"` + Closed_at string `json:"closed_at"` Events_url string `json:"events_url"` - Following_url string `json:"following_url"` + Active_lock_reason string `json:"active_lock_reason"` Id int64 `json:"id"` - Repos_url string `json:"repos_url"` - Gravatar_id string `json:"gravatar_id"` - Url string `json:"url"` - Email string `json:"email,omitempty"` - Organizations_url string `json:"organizations_url"` - Gists_url string `json:"gists_url"` - Name string `json:"name,omitempty"` + Body string `json:"body"` // Contents of the issue + Title string `json:"title"` // Title of the issue + Assignees []map[string]interface{} `json:"assignees"` + Sub_issues_summary map[string]interface{} `json:"sub_issues_summary,omitempty"` + Assignee map[string]interface{} `json:"assignee,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_release_released represents the GeneratedType_Webhook_release_released schema from the OpenAPI specification +type GeneratedType_Webhook_release_released struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Scope string `json:"scope"` // The scope of the membership. Currently, can only be `team`. - Sender map[string]interface{} `json:"sender"` - Member Webhooksuser `json:"member"` - Team Webhooksteam `json:"team"` // Groups of organization members that gives permissions on specified repositories. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Organization_full represents the GeneratedType_Organization_full schema from the OpenAPI specification +type GeneratedType_Organization_full struct { + Members_can_delete_issues bool `json:"members_can_delete_issues,omitempty"` + Members_can_create_internal_repositories bool `json:"members_can_create_internal_repositories,omitempty"` + Public_members_url string `json:"public_members_url"` + Members_can_fork_private_repositories bool `json:"members_can_fork_private_repositories,omitempty"` + Location string `json:"location,omitempty"` Created_at string `json:"created_at"` - Name string `json:"name"` // The name of the secret. - Updated_at string `json:"updated_at"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Full_description string `json:"full_description,omitempty"` // A description of the rule used to detect the alert. - Id string `json:"id,omitempty"` // A unique identifier for the rule used to detect the alert. - Description string `json:"description,omitempty"` // A short description of the rule used to detect the alert. - Help string `json:"help,omitempty"` // Detailed documentation for the rule as GitHub Flavored Markdown. - Name string `json:"name,omitempty"` // The name of the rule used to detect the alert. - Security_severity_level string `json:"security_severity_level,omitempty"` // The security severity of the alert. - Tags []string `json:"tags,omitempty"` // A set of tags applicable for the rule. - Help_uri string `json:"help_uri,omitempty"` // A link to the documentation for the rule used to detect the alert. - Severity string `json:"severity,omitempty"` // The severity of the alert. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Size int `json:"size"` - TypeField string `json:"type"` - Git_url string `json:"git_url"` + Secret_scanning_enabled_for_new_repositories bool `json:"secret_scanning_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether secret scanning is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. + Repos_url string `json:"repos_url"` + Two_factor_requirement_enabled bool `json:"two_factor_requirement_enabled,omitempty"` + Default_repository_branch string `json:"default_repository_branch,omitempty"` // The default branch for repositories created in this organization. + Billing_email string `json:"billing_email,omitempty"` + Avatar_url string `json:"avatar_url"` + Members_can_create_public_repositories bool `json:"members_can_create_public_repositories,omitempty"` Html_url string `json:"html_url"` - Name string `json:"name"` - Target string `json:"target"` - Path string `json:"path"` - Links map[string]interface{} `json:"_links"` + Total_private_repos int `json:"total_private_repos,omitempty"` + Events_url string `json:"events_url"` + Members_can_create_private_repositories bool `json:"members_can_create_private_repositories,omitempty"` + Members_allowed_repository_creation_type string `json:"members_allowed_repository_creation_type,omitempty"` + Secret_scanning_push_protection_custom_link_enabled bool `json:"secret_scanning_push_protection_custom_link_enabled,omitempty"` // Whether a custom link is shown to contributors who are blocked from pushing a secret by push protection. + Blog string `json:"blog,omitempty"` + Public_repos int `json:"public_repos"` + Public_gists int `json:"public_gists"` + TypeField string `json:"type"` + Deploy_keys_enabled_for_repositories bool `json:"deploy_keys_enabled_for_repositories,omitempty"` // Controls whether or not deploy keys may be added and used for repositories in the organization. + Id int `json:"id"` + Updated_at string `json:"updated_at"` + Archived_at string `json:"archived_at"` + Dependabot_security_updates_enabled_for_new_repositories bool `json:"dependabot_security_updates_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. + Default_repository_permission string `json:"default_repository_permission,omitempty"` + Node_id string `json:"node_id"` + Owned_private_repos int `json:"owned_private_repos,omitempty"` + Hooks_url string `json:"hooks_url"` + Is_verified bool `json:"is_verified,omitempty"` + Has_organization_projects bool `json:"has_organization_projects"` + Private_gists int `json:"private_gists,omitempty"` + Members_can_create_teams bool `json:"members_can_create_teams,omitempty"` + Twitter_username string `json:"twitter_username,omitempty"` + Secret_scanning_push_protection_enabled_for_new_repositories bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether secret scanning push protection is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. + Issues_url string `json:"issues_url"` + Followers int `json:"followers"` + Display_commenter_full_name_setting_enabled bool `json:"display_commenter_full_name_setting_enabled,omitempty"` + Company string `json:"company,omitempty"` Url string `json:"url"` - Download_url string `json:"download_url"` - Sha string `json:"sha"` + Dependabot_alerts_enabled_for_new_repositories bool `json:"dependabot_alerts_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether Dependabot alerts are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. + Members_can_change_repo_visibility bool `json:"members_can_change_repo_visibility,omitempty"` + Name string `json:"name,omitempty"` + Dependency_graph_enabled_for_new_repositories bool `json:"dependency_graph_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether dependency graph is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. + Following int `json:"following"` + Members_can_view_dependency_insights bool `json:"members_can_view_dependency_insights,omitempty"` + Members_can_create_private_pages bool `json:"members_can_create_private_pages,omitempty"` + Readers_can_create_discussions bool `json:"readers_can_create_discussions,omitempty"` + Email string `json:"email,omitempty"` + Advanced_security_enabled_for_new_repositories bool `json:"advanced_security_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether GitHub Advanced Security is enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. + Plan map[string]interface{} `json:"plan,omitempty"` + Members_can_invite_outside_collaborators bool `json:"members_can_invite_outside_collaborators,omitempty"` + Members_url string `json:"members_url"` + Collaborators int `json:"collaborators,omitempty"` // The number of collaborators on private repositories. This field may be null if the number of private repositories is over 50,000. + Description string `json:"description"` + Login string `json:"login"` + Members_can_create_repositories bool `json:"members_can_create_repositories,omitempty"` + Members_can_create_public_pages bool `json:"members_can_create_public_pages,omitempty"` + Has_repository_projects bool `json:"has_repository_projects"` + Members_can_delete_repositories bool `json:"members_can_delete_repositories,omitempty"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Disk_usage int `json:"disk_usage,omitempty"` + Members_can_create_pages bool `json:"members_can_create_pages,omitempty"` + Secret_scanning_push_protection_custom_link string `json:"secret_scanning_push_protection_custom_link,omitempty"` // An optional URL string to display to contributors who are blocked from pushing a secret. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Documentation_url string `json:"documentation_url,omitempty"` - Message string `json:"message,omitempty"` - Status string `json:"status,omitempty"` - Url string `json:"url,omitempty"` +// GeneratedType_Demilestoned_issue_event represents the GeneratedType_Demilestoned_issue_event schema from the OpenAPI specification +type GeneratedType_Demilestoned_issue_event struct { + Milestone map[string]interface{} `json:"milestone"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_url string `json:"commit_url"` + Created_at string `json:"created_at"` + Node_id string `json:"node_id"` + Commit_id string `json:"commit_id"` + Id int `json:"id"` + Url string `json:"url"` + Event string `json:"event"` } -// Webhooksrule represents the Webhooksrule schema from the OpenAPI specification -type Webhooksrule struct { - Name string `json:"name"` - Required_deployments_enforcement_level string `json:"required_deployments_enforcement_level"` +// Codespace represents the Codespace schema from the OpenAPI specification +type Codespace struct { + Web_url string `json:"web_url"` // URL to access this codespace on the web. + Idle_timeout_notice string `json:"idle_timeout_notice,omitempty"` // Text to show user when codespace idle timeout minutes has been overriden by an organization policy + Devcontainer_path string `json:"devcontainer_path,omitempty"` // Path to devcontainer.json from repo root used to create Codespace. + Start_url string `json:"start_url"` // API URL to start this codespace. + Last_known_stop_notice string `json:"last_known_stop_notice,omitempty"` // The text to display to a user when a codespace has been stopped for a potentially actionable reason. + Location string `json:"location"` // The initally assigned location of a new codespace. + Display_name string `json:"display_name,omitempty"` // Display name for this codespace. + Id int64 `json:"id"` + Billable_owner GeneratedType_Simple_user `json:"billable_owner"` // A GitHub user. + Url string `json:"url"` // API URL for this codespace. + Idle_timeout_minutes int `json:"idle_timeout_minutes"` // The number of minutes of inactivity after which this codespace will be automatically stopped. + Machines_url string `json:"machines_url"` // API URL to access available alternate machine types for this codespace. + Pending_operation_disabled_reason string `json:"pending_operation_disabled_reason,omitempty"` // Text to show user when codespace is disabled by a pending operation + Prebuild bool `json:"prebuild"` // Whether the codespace was created from a prebuild. + Publish_url string `json:"publish_url,omitempty"` // API URL to publish this codespace to a new repository. + Pulls_url string `json:"pulls_url"` // API URL for the Pull Request associated with this codespace, if any. + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Name string `json:"name"` // Automatically generated name of this codespace. + Runtime_constraints map[string]interface{} `json:"runtime_constraints,omitempty"` + Retention_expires_at string `json:"retention_expires_at,omitempty"` // When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at" + Environment_id string `json:"environment_id"` // UUID identifying this codespace's environment. Updated_at string `json:"updated_at"` - Allow_deletions_enforcement_level string `json:"allow_deletions_enforcement_level"` - Authorized_actors_only bool `json:"authorized_actors_only"` - Id int `json:"id"` - Signature_requirement_enforcement_level string `json:"signature_requirement_enforcement_level"` - Authorized_actor_names []string `json:"authorized_actor_names"` - Lock_branch_enforcement_level string `json:"lock_branch_enforcement_level"` // The enforcement level of the branch lock setting. `off` means the branch is not locked, `non_admins` means the branch is read-only for non_admins, and `everyone` means the branch is read-only for everyone. - Require_code_owner_review bool `json:"require_code_owner_review"` - Pull_request_reviews_enforcement_level string `json:"pull_request_reviews_enforcement_level"` - Repository_id int `json:"repository_id"` - Require_last_push_approval bool `json:"require_last_push_approval,omitempty"` // Whether the most recent push must be approved by someone other than the person who pushed it - Merge_queue_enforcement_level string `json:"merge_queue_enforcement_level"` - Required_status_checks []string `json:"required_status_checks"` - Required_status_checks_enforcement_level string `json:"required_status_checks_enforcement_level"` - Lock_allows_fork_sync bool `json:"lock_allows_fork_sync,omitempty"` // Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow users to pull changes from upstream when the branch is locked. This setting is only applicable for forks. - Required_approving_review_count int `json:"required_approving_review_count"` - Required_conversation_resolution_level string `json:"required_conversation_resolution_level"` - Authorized_dismissal_actors_only bool `json:"authorized_dismissal_actors_only"` - Ignore_approvals_from_contributors bool `json:"ignore_approvals_from_contributors"` - Admin_enforced bool `json:"admin_enforced"` - Linear_history_requirement_enforcement_level string `json:"linear_history_requirement_enforcement_level"` - Create_protected bool `json:"create_protected,omitempty"` + Stop_url string `json:"stop_url"` // API URL to stop this codespace. + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + Git_status map[string]interface{} `json:"git_status"` // Details about the codespace's git repository. Created_at string `json:"created_at"` - Dismiss_stale_reviews_on_push bool `json:"dismiss_stale_reviews_on_push"` - Strict_required_status_checks_policy bool `json:"strict_required_status_checks_policy"` - Allow_force_pushes_enforcement_level string `json:"allow_force_pushes_enforcement_level"` + Machine GeneratedType_Nullable_codespace_machine `json:"machine"` // A description of the machine powering a codespace. + Retention_period_minutes int `json:"retention_period_minutes,omitempty"` // Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). + Recent_folders []string `json:"recent_folders"` + State string `json:"state"` // State of this codespace. + Last_used_at string `json:"last_used_at"` // Last known time this codespace was started. + Pending_operation bool `json:"pending_operation,omitempty"` // Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Confirm_delete_url string `json:"confirm_delete_url"` // Next deletable analysis in chain, with last analysis deletion confirmation - Next_analysis_url string `json:"next_analysis_url"` // Next deletable analysis in chain, without last analysis deletion confirmation +// GeneratedType_Classroom_assignment_grade represents the GeneratedType_Classroom_assignment_grade schema from the OpenAPI specification +type GeneratedType_Classroom_assignment_grade struct { + Assignment_name string `json:"assignment_name"` // Name of the assignment + Group_name string `json:"group_name,omitempty"` // If a group assignment, name of the group the student is in + Points_available int `json:"points_available"` // Number of points available for the assignment + Roster_identifier string `json:"roster_identifier"` // Roster identifier of the student + Starter_code_url string `json:"starter_code_url"` // URL of the starter code for the assignment + Student_repository_url string `json:"student_repository_url"` // URL of the student's assignment repository + Submission_timestamp string `json:"submission_timestamp"` // Timestamp of the student's assignment submission + Points_awarded int `json:"points_awarded"` // Number of points awarded to the student + Assignment_url string `json:"assignment_url"` // URL of the assignment + Github_username string `json:"github_username"` // GitHub username of the student + Student_repository_name string `json:"student_repository_name"` // Name of the student's assignment repository } -// Tag represents the Tag schema from the OpenAPI specification -type Tag struct { - Zipball_url string `json:"zipball_url"` - Commit map[string]interface{} `json:"commit"` - Name string `json:"name"` - Node_id string `json:"node_id"` - Tarball_url string `json:"tarball_url"` +// GeneratedType_Repository_rule_max_file_size represents the GeneratedType_Repository_rule_max_file_size schema from the OpenAPI specification +type GeneratedType_Repository_rule_max_file_size struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Protected_branches bool `json:"protected_branches"` // Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`. - Custom_branch_policies bool `json:"custom_branch_policies"` // Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`. +// GeneratedType_Issue_type represents the GeneratedType_Issue_type schema from the OpenAPI specification +type GeneratedType_Issue_type struct { + Is_enabled bool `json:"is_enabled,omitempty"` // The enabled state of the issue type. + Name string `json:"name"` // The name of the issue type. + Node_id string `json:"node_id"` // The node identifier of the issue type. + Updated_at string `json:"updated_at,omitempty"` // The time the issue type last updated. + Color string `json:"color,omitempty"` // The color of the issue type. + Created_at string `json:"created_at,omitempty"` // The time the issue type created. + Description string `json:"description"` // The description of the issue type. + Id int `json:"id"` // The unique identifier of the issue type. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action,omitempty"` - Check_run GeneratedType `json:"check_run"` // A check performed on the code of a given code change - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Webhook_pull_request_review_submitted represents the GeneratedType_Webhook_pull_request_review_submitted schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_submitted struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Review Webhooksreview `json:"review"` // The review that was affected. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Thread map[string]interface{} `json:"thread"` +// GeneratedType_Webhook_repository_vulnerability_alert_create represents the GeneratedType_Webhook_repository_vulnerability_alert_create schema from the OpenAPI specification +type GeneratedType_Webhook_repository_vulnerability_alert_create struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. + Alert Webhooksalert `json:"alert"` // The security alert of the vulnerable dependency. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Links map[string]interface{} `json:"_links"` - Commit_id string `json:"commit_id"` // A commit SHA for the review. If the commit object was garbage collected or forcibly deleted, then it no longer exists in Git and this value will be `null`. +// GeneratedType_Code_scanning_sarifs_status represents the GeneratedType_Code_scanning_sarifs_status schema from the OpenAPI specification +type GeneratedType_Code_scanning_sarifs_status struct { + Errors []string `json:"errors,omitempty"` // Any errors that ocurred during processing of the delivery. + Processing_status string `json:"processing_status,omitempty"` // `pending` files have not yet been processed, while `complete` means results from the SARIF have been stored. `failed` files have either not been processed at all, or could only be partially processed. + Analyses_url string `json:"analyses_url,omitempty"` // The REST API URL for getting the analyses associated with the upload. +} + +// Webhooksmilestone represents the Webhooksmilestone schema from the OpenAPI specification +type Webhooksmilestone struct { + Labels_url string `json:"labels_url"` + Open_issues int `json:"open_issues"` Node_id string `json:"node_id"` - State string `json:"state"` - Submitted_at string `json:"submitted_at,omitempty"` + Updated_at string `json:"updated_at"` + Closed_at string `json:"closed_at"` + Id int `json:"id"` + Creator map[string]interface{} `json:"creator"` + Closed_issues int `json:"closed_issues"` + State string `json:"state"` // The state of the milestone. + Created_at string `json:"created_at"` + Url string `json:"url"` + Title string `json:"title"` // The title of the milestone. Html_url string `json:"html_url"` - User GeneratedType `json:"user"` // A GitHub user. - Body string `json:"body"` // The text of the review. - Id int64 `json:"id"` // Unique identifier of the review - Pull_request_url string `json:"pull_request_url"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Body_html string `json:"body_html,omitempty"` - Body_text string `json:"body_text,omitempty"` + Number int `json:"number"` // The number of the milestone. + Due_on string `json:"due_on"` + Description string `json:"description"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the classroom. - Url string `json:"url"` // The url of the classroom on GitHub Classroom. +// GeneratedType_Simple_classroom represents the GeneratedType_Simple_classroom schema from the OpenAPI specification +type GeneratedType_Simple_classroom struct { Archived bool `json:"archived"` // Returns whether classroom is archived or not. Id int `json:"id"` // Unique identifier of the classroom. + Name string `json:"name"` // The name of the classroom. + Url string `json:"url"` // The url of the classroom on GitHub Classroom. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Color string `json:"color"` +// GeneratedType_Marketplace_listing_plan represents the GeneratedType_Marketplace_listing_plan schema from the OpenAPI specification +type GeneratedType_Marketplace_listing_plan struct { + Yearly_price_in_cents int `json:"yearly_price_in_cents"` + Accounts_url string `json:"accounts_url"` + Number int `json:"number"` + Url string `json:"url"` + Description string `json:"description"` + Id int `json:"id"` Name string `json:"name"` + Price_model string `json:"price_model"` + Bullets []string `json:"bullets"` + Has_free_trial bool `json:"has_free_trial"` + Monthly_price_in_cents int `json:"monthly_price_in_cents"` + Unit_name string `json:"unit_name"` + State string `json:"state"` } -// Feed represents the Feed schema from the OpenAPI specification -type Feed struct { - Current_user_organization_url string `json:"current_user_organization_url,omitempty"` - Current_user_public_url string `json:"current_user_public_url,omitempty"` - Repository_discussions_url string `json:"repository_discussions_url,omitempty"` // A feed of discussions for a given repository. - Security_advisories_url string `json:"security_advisories_url,omitempty"` - Current_user_url string `json:"current_user_url,omitempty"` - Timeline_url string `json:"timeline_url"` - Links map[string]interface{} `json:"_links"` - Current_user_organization_urls []string `json:"current_user_organization_urls,omitempty"` - Repository_discussions_category_url string `json:"repository_discussions_category_url,omitempty"` // A feed of discussions for a given repository and category. - User_url string `json:"user_url"` - Current_user_actor_url string `json:"current_user_actor_url,omitempty"` +// GeneratedType_Timeline_line_commented_event represents the GeneratedType_Timeline_line_commented_event schema from the OpenAPI specification +type GeneratedType_Timeline_line_commented_event struct { + Comments []GeneratedType_Pull_request_review_comment `json:"comments,omitempty"` + Event string `json:"event,omitempty"` + Node_id string `json:"node_id,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the machine. +// GeneratedType_Empty_object represents the GeneratedType_Empty_object schema from the OpenAPI specification +type GeneratedType_Empty_object struct { +} + +// GeneratedType_Codespace_machine represents the GeneratedType_Codespace_machine schema from the OpenAPI specification +type GeneratedType_Codespace_machine struct { Operating_system string `json:"operating_system"` // The operating system of the machine. Prebuild_availability string `json:"prebuild_availability"` // Whether a prebuild is currently available when creating a codespace for this machine and repository. If a branch was not specified as a ref, the default branch will be assumed. Value will be "null" if prebuilds are not supported or prebuild availability could not be determined. Value will be "none" if no prebuild is available. Latest values "ready" and "in_progress" indicate the prebuild availability status. Storage_in_bytes int `json:"storage_in_bytes"` // How much storage is available to the codespace. Cpus int `json:"cpus"` // How many cores are available to the codespace. Display_name string `json:"display_name"` // The display name of the machine includes cores, memory, and storage. Memory_in_bytes int `json:"memory_in_bytes"` // How much memory is available to the codespace. + Name string `json:"name"` // The name of the machine. +} + +// GeneratedType_Webhook_installation_repositories_added represents the GeneratedType_Webhook_installation_repositories_added schema from the OpenAPI specification +type GeneratedType_Webhook_installation_repositories_added struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repositories_removed []map[string]interface{} `json:"repositories_removed"` // An array of repository objects, which were removed from the installation. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Installation Installation `json:"installation"` // Installation + Repositories_added []map[string]interface{} `json:"repositories_added"` // An array of repository objects, which were added to the installation. + Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requester Webhooksuser `json:"requester"` +} + +// GeneratedType_Webhook_pull_request_review_comment_deleted represents the GeneratedType_Webhook_pull_request_review_comment_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_comment_deleted struct { + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Comment Webhooksreviewcomment `json:"comment"` // The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// Event represents the Event schema from the OpenAPI specification +type Event struct { TypeField string `json:"type"` + Actor Actor `json:"actor"` // Actor + Created_at string `json:"created_at"` + Id string `json:"id"` + Org Actor `json:"org,omitempty"` // Actor + Payload map[string]interface{} `json:"payload"` + Public bool `json:"public"` + Repo map[string]interface{} `json:"repo"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Message string `json:"message,omitempty"` // Commit message to be used. - Target_ref string `json:"target_ref,omitempty"` // The Git reference of target branch for the commit. Branch needs to already exist. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation. +// GeneratedType_Webhook_workflow_job_waiting represents the GeneratedType_Webhook_workflow_job_waiting schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_job_waiting struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow_job map[string]interface{} `json:"workflow_job"` + Action string `json:"action"` + Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +} + +// GeneratedType_Webhook_installation_new_permissions_accepted represents the GeneratedType_Webhook_installation_new_permissions_accepted schema from the OpenAPI specification +type GeneratedType_Webhook_installation_new_permissions_accepted struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requester interface{} `json:"requester,omitempty"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation Installation `json:"installation"` // Installation + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. +} + +// GeneratedType_Webhook_check_run_requested_action_form_encoded represents the GeneratedType_Webhook_check_run_requested_action_form_encoded schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_requested_action_form_encoded struct { + Payload string `json:"payload"` // A URL-encoded string of the check_run.requested_action JSON payload. The decoded payload is a JSON object. +} + +// GeneratedType_Webhook_repository_vulnerability_alert_dismiss represents the GeneratedType_Webhook_repository_vulnerability_alert_dismiss schema from the OpenAPI specification +type GeneratedType_Webhook_repository_vulnerability_alert_dismiss struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Alert map[string]interface{} `json:"alert"` // The security alert of the vulnerable dependency. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +} + +// GeneratedType_Webhook_label_created represents the GeneratedType_Webhook_label_created schema from the OpenAPI specification +type GeneratedType_Webhook_label_created struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Label Webhookslabel `json:"label"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +} + +// GeneratedType_Repository_advisory represents the GeneratedType_Repository_advisory schema from the OpenAPI specification +type GeneratedType_Repository_advisory struct { + Summary string `json:"summary"` // A short summary of the advisory. + Cwes []map[string]interface{} `json:"cwes"` + Description string `json:"description"` // A detailed description of what the advisory entails. + Submission map[string]interface{} `json:"submission"` + Collaborating_users []GeneratedType_Simple_user `json:"collaborating_users"` // A list of users that collaborate on the advisory. + Cvss_severities GeneratedType_Cvss_severities `json:"cvss_severities,omitempty"` + Cvss map[string]interface{} `json:"cvss"` + Identifiers []map[string]interface{} `json:"identifiers"` + Vulnerabilities []GeneratedType_Repository_advisory_vulnerability `json:"vulnerabilities"` + Severity string `json:"severity"` // The severity of the advisory. + State string `json:"state"` // The state of the advisory. + Url string `json:"url"` // The API URL for the advisory. + Author interface{} `json:"author"` // The author of the advisory. + Collaborating_teams []Team `json:"collaborating_teams"` // A list of teams that collaborate on the advisory. + Created_at string `json:"created_at"` // The date and time of when the advisory was created, in ISO 8601 format. + Credits_detailed []GeneratedType_Repository_advisory_credit `json:"credits_detailed"` + Ghsa_id string `json:"ghsa_id"` // The GitHub Security Advisory ID. + Private_fork interface{} `json:"private_fork"` // A temporary private fork of the advisory's repository for collaborating on a fix. + Credits []map[string]interface{} `json:"credits"` + Updated_at string `json:"updated_at"` // The date and time of when the advisory was last updated, in ISO 8601 format. + Withdrawn_at string `json:"withdrawn_at"` // The date and time of when the advisory was withdrawn, in ISO 8601 format. + Cve_id string `json:"cve_id"` // The Common Vulnerabilities and Exposures (CVE) ID. + Published_at string `json:"published_at"` // The date and time of when the advisory was published, in ISO 8601 format. + Publisher interface{} `json:"publisher"` // The publisher of the advisory. + Closed_at string `json:"closed_at"` // The date and time of when the advisory was closed, in ISO 8601 format. + Html_url string `json:"html_url"` // The URL for the advisory. + Cwe_ids []string `json:"cwe_ids"` // A list of only the CWE IDs. +} + +// GeneratedType_Gpg_key represents the GeneratedType_Gpg_key schema from the OpenAPI specification +type GeneratedType_Gpg_key struct { + Created_at string `json:"created_at"` + Id int64 `json:"id"` + Can_encrypt_comms bool `json:"can_encrypt_comms"` + Revoked bool `json:"revoked"` + Can_sign bool `json:"can_sign"` + Public_key string `json:"public_key"` + Emails []map[string]interface{} `json:"emails"` + Key_id string `json:"key_id"` + Expires_at string `json:"expires_at"` + Raw_key string `json:"raw_key"` + Subkeys []map[string]interface{} `json:"subkeys"` + Can_certify bool `json:"can_certify"` + Primary_key_id int `json:"primary_key_id"` + Can_encrypt_storage bool `json:"can_encrypt_storage"` + Name string `json:"name,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_card Webhooksprojectcard `json:"project_card"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Copilot_organization_details represents the GeneratedType_Copilot_organization_details schema from the OpenAPI specification +type GeneratedType_Copilot_organization_details struct { + Seat_breakdown GeneratedType_Copilot_organization_seat_breakdown `json:"seat_breakdown"` // The breakdown of Copilot Business seats for the organization. + Seat_management_setting string `json:"seat_management_setting"` // The mode of assigning new seats. + Cli string `json:"cli,omitempty"` // The organization policy for allowing or disallowing Copilot in the CLI. + Ide_chat string `json:"ide_chat,omitempty"` // The organization policy for allowing or disallowing Copilot Chat in the IDE. + Plan_type string `json:"plan_type,omitempty"` // The Copilot plan of the organization, or the parent enterprise, when applicable. + Platform_chat string `json:"platform_chat,omitempty"` // The organization policy for allowing or disallowing Copilot features on GitHub.com. + Public_code_suggestions string `json:"public_code_suggestions"` // The organization policy for allowing or blocking suggestions matching public code (duplication detection filter). } -// Webhooksmilestone represents the Webhooksmilestone schema from the OpenAPI specification -type Webhooksmilestone struct { - Labels_url string `json:"labels_url"` - Creator map[string]interface{} `json:"creator"` - Url string `json:"url"` - Html_url string `json:"html_url"` +// GeneratedType_Assigned_issue_event represents the GeneratedType_Assigned_issue_event schema from the OpenAPI specification +type GeneratedType_Assigned_issue_event struct { Created_at string `json:"created_at"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_id string `json:"commit_id"` Id int `json:"id"` - Number int `json:"number"` // The number of the milestone. - Closed_at string `json:"closed_at"` + Assignee GeneratedType_Simple_user `json:"assignee"` // A GitHub user. Node_id string `json:"node_id"` - Title string `json:"title"` // The title of the milestone. - Updated_at string `json:"updated_at"` - Description string `json:"description"` - Open_issues int `json:"open_issues"` - Closed_issues int `json:"closed_issues"` - State string `json:"state"` // The state of the milestone. - Due_on string `json:"due_on"` + Event string `json:"event"` + Performed_via_github_app Integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Url string `json:"url"` + Assigner GeneratedType_Simple_user `json:"assigner"` // A GitHub user. + Commit_url string `json:"commit_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_custom_property_promoted_to_enterprise represents the GeneratedType_Webhook_custom_property_promoted_to_enterprise schema from the OpenAPI specification +type GeneratedType_Webhook_custom_property_promoted_to_enterprise struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Effective_date string `json:"effective_date"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Sender GeneratedType `json:"sender"` // A GitHub user. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Marketplace_purchase map[string]interface{} `json:"marketplace_purchase"` - Previous_marketplace_purchase Webhookspreviousmarketplacepurchase `json:"previous_marketplace_purchase,omitempty"` + Definition GeneratedType_Custom_property `json:"definition"` // Custom property defined on an organization + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name pattern that branches must match in order to deploy to the environment. Wildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`. For more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch). -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_pull_request_converted_to_draft represents the GeneratedType_Webhook_pull_request_converted_to_draft schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_converted_to_draft struct { + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request GeneratedType_Pull_request_webhook `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Personal_access_token_request GeneratedType `json:"personal_access_token_request"` // Details of a Personal Access Token Request. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Webhook_delete represents the GeneratedType_Webhook_delete schema from the OpenAPI specification +type GeneratedType_Webhook_delete struct { + Pusher_type string `json:"pusher_type"` // The pusher type for the event. Can be either `user` or a deploy key. + Ref string `json:"ref"` // The [`git ref`](https://docs.github.com/rest/git/refs#get-a-reference) resource. + Ref_type string `json:"ref_type"` // The type of Git ref object deleted in the repository. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name pattern that branches or tags must match in order to deploy to the environment. Wildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`. For more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch). - TypeField string `json:"type,omitempty"` // Whether this rule targets a branch or tag +// GeneratedType_Code_scanning_autofix_commits represents the GeneratedType_Code_scanning_autofix_commits schema from the OpenAPI specification +type GeneratedType_Code_scanning_autofix_commits struct { + Message string `json:"message,omitempty"` // Commit message to be used. + Target_ref string `json:"target_ref,omitempty"` // The Git reference of target branch for the commit. Branch needs to already exist. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation. } -// Migration represents the Migration schema from the OpenAPI specification -type Migration struct { - Lock_repositories bool `json:"lock_repositories"` - Org_metadata_only bool `json:"org_metadata_only"` - Exclude_owner_projects bool `json:"exclude_owner_projects"` - State string `json:"state"` - Created_at string `json:"created_at"` - Updated_at string `json:"updated_at"` - Guid string `json:"guid"` - Exclude_releases bool `json:"exclude_releases"` - Exclude_attachments bool `json:"exclude_attachments"` - Archive_url string `json:"archive_url,omitempty"` - Repositories []Repository `json:"repositories"` // The repositories included in the migration. Only returned for export migrations. - Url string `json:"url"` - Owner GeneratedType `json:"owner"` // A GitHub user. - Id int64 `json:"id"` - Exclude []string `json:"exclude,omitempty"` // Exclude related items from being returned in the response in order to improve performance of the request. The array can include any of: `"repositories"`. - Exclude_git_data bool `json:"exclude_git_data"` - Exclude_metadata bool `json:"exclude_metadata"` - Node_id string `json:"node_id"` +// GeneratedType_Codespace_export_details represents the GeneratedType_Codespace_export_details schema from the OpenAPI specification +type GeneratedType_Codespace_export_details struct { + Completed_at string `json:"completed_at,omitempty"` // Completion time of the last export operation + Export_url string `json:"export_url,omitempty"` // Url for fetching export details + Html_url string `json:"html_url,omitempty"` // Web url for the exported branch + Id string `json:"id,omitempty"` // Id for the export details + Sha string `json:"sha,omitempty"` // Git commit SHA of the exported branch + State string `json:"state,omitempty"` // State of the latest export + Branch string `json:"branch,omitempty"` // Name of the exported branch } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Merge_group GeneratedType `json:"merge_group"` // A group of pull requests that the merge queue has grouped together to be merged. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Code_scanning_variant_analysis represents the GeneratedType_Code_scanning_variant_analysis schema from the OpenAPI specification +type GeneratedType_Code_scanning_variant_analysis struct { + Updated_at string `json:"updated_at,omitempty"` // The date and time at which the variant analysis was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Skipped_repositories map[string]interface{} `json:"skipped_repositories,omitempty"` // Information about repositories that were skipped from processing. This information is only available to the user that initiated the variant analysis. + Completed_at string `json:"completed_at,omitempty"` // The date and time at which the variant analysis was completed, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. Will be null if the variant analysis has not yet completed or this information is not available. + Id int `json:"id"` // The ID of the variant analysis. + Query_pack_url string `json:"query_pack_url"` // The download url for the query pack. + Scanned_repositories []map[string]interface{} `json:"scanned_repositories,omitempty"` + Actions_workflow_run_id int `json:"actions_workflow_run_id,omitempty"` // The GitHub Actions workflow run used to execute this variant analysis. This is only available if the workflow run has started. + Controller_repo GeneratedType_Simple_repository `json:"controller_repo"` // A GitHub repository. + Created_at string `json:"created_at,omitempty"` // The date and time at which the variant analysis was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Failure_reason string `json:"failure_reason,omitempty"` // The reason for a failure of the variant analysis. This is only available if the variant analysis has failed. + Query_language string `json:"query_language"` // The language targeted by the CodeQL query + Status string `json:"status"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Required bool `json:"required,omitempty"` - Updated_at string `json:"updated_at"` - Url string `json:"url"` - Avatar_url string `json:"avatar_url"` - Id int `json:"id"` - Description string `json:"description"` - Node_id string `json:"node_id"` - Target_url string `json:"target_url"` - State string `json:"state"` - Context string `json:"context"` - Created_at string `json:"created_at"` +// GeneratedType_Codeowners_errors represents the GeneratedType_Codeowners_errors schema from the OpenAPI specification +type GeneratedType_Codeowners_errors struct { + Errors []map[string]interface{} `json:"errors"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created bool `json:"created"` // Whether this push created the `ref`. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository map[string]interface{} `json:"repository"` // A git repository - Head_commit map[string]interface{} `json:"head_commit"` - Before string `json:"before"` // The SHA of the most recent commit on `ref` before the push. - Compare string `json:"compare"` // URL that shows the changes in this `ref` update, from the `before` commit to the `after` commit. For a newly created `ref` that is directly based on the default branch, this is the comparison between the head of the default branch and the `after` commit. Otherwise, this shows all commits until the `after` commit. - Forced bool `json:"forced"` // Whether this push was a force push of the `ref`. - After string `json:"after"` // The SHA of the most recent commit on `ref` after the push. - Commits []map[string]interface{} `json:"commits"` // An array of commit objects describing the pushed commits. (Pushed commits are all commits that are included in the `compare` between the `before` commit and the `after` commit.) The array includes a maximum of 2048 commits. If necessary, you can use the [Commits API](https://docs.github.com/rest/commits) to fetch additional commits. - Pusher map[string]interface{} `json:"pusher"` // Metaproperties for Git author/committer information. - Deleted bool `json:"deleted"` // Whether this push deleted the `ref`. - Base_ref string `json:"base_ref"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Ref string `json:"ref"` // The full git ref that was pushed. Example: `refs/heads/main` or `refs/tags/v3.14.1`. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Code_scanning_analysis_deletion represents the GeneratedType_Code_scanning_analysis_deletion schema from the OpenAPI specification +type GeneratedType_Code_scanning_analysis_deletion struct { + Confirm_delete_url string `json:"confirm_delete_url"` // Next deletable analysis in chain, with last analysis deletion confirmation + Next_analysis_url string `json:"next_analysis_url"` // Next deletable analysis in chain, without last analysis deletion confirmation } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Requested_reviewer GeneratedType `json:"requested_reviewer,omitempty"` // A GitHub user. - Label GeneratedType `json:"label,omitempty"` // Issue Event Label - Created_at string `json:"created_at"` - Event string `json:"event"` - Lock_reason string `json:"lock_reason,omitempty"` - Requested_team Team `json:"requested_team,omitempty"` // Groups of organization members that gives permissions on specified repositories. - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Actor GeneratedType `json:"actor"` // A GitHub user. - Project_card GeneratedType `json:"project_card,omitempty"` // Issue Event Project Card - Commit_url string `json:"commit_url"` - Review_requester GeneratedType `json:"review_requester,omitempty"` // A GitHub user. - Assignee GeneratedType `json:"assignee,omitempty"` // A GitHub user. - Issue GeneratedType `json:"issue,omitempty"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Milestone GeneratedType `json:"milestone,omitempty"` // Issue Event Milestone - Node_id string `json:"node_id"` - Rename GeneratedType `json:"rename,omitempty"` // Issue Event Rename - Id int64 `json:"id"` - Assigner GeneratedType `json:"assigner,omitempty"` // A GitHub user. - Author_association string `json:"author_association,omitempty"` // How the author is associated with the repository. - Commit_id string `json:"commit_id"` - Url string `json:"url"` - Dismissed_review GeneratedType `json:"dismissed_review,omitempty"` +// GeneratedType_Webhook_registry_package_published represents the GeneratedType_Webhook_registry_package_published schema from the OpenAPI specification +type GeneratedType_Webhook_registry_package_published struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Registry_package map[string]interface{} `json:"registry_package"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Label Webhookslabel `json:"label"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Git_tree represents the GeneratedType_Git_tree schema from the OpenAPI specification +type GeneratedType_Git_tree struct { + Url string `json:"url,omitempty"` + Sha string `json:"sha"` + Tree []map[string]interface{} `json:"tree"` // Objects specifying a tree structure + Truncated bool `json:"truncated"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Ecosystem string `json:"ecosystem"` // The package's language or package management ecosystem. - Name string `json:"name"` // The unique package name within its ecosystem. +// GeneratedType_Webhook_marketplace_purchase_purchased represents the GeneratedType_Webhook_marketplace_purchase_purchased schema from the OpenAPI specification +type GeneratedType_Webhook_marketplace_purchase_purchased struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Effective_date string `json:"effective_date"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Previous_marketplace_purchase Webhookspreviousmarketplacepurchase `json:"previous_marketplace_purchase,omitempty"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Token_expired bool `json:"token_expired"` // Whether the associated fine-grained personal access token has expired. - Repository_selection string `json:"repository_selection"` // Type of repository selection requested. - Token_name string `json:"token_name"` // The name given to the user's token. This field can also be found in an organization's settings page for Active Tokens. - Id int `json:"id"` // Unique identifier of the fine-grained personal access token grant. The `pat_id` used to get details about an approved fine-grained personal access token. - Owner GeneratedType `json:"owner"` // A GitHub user. - Token_expires_at string `json:"token_expires_at"` // Date and time when the associated fine-grained personal access token expires. - Token_last_used_at string `json:"token_last_used_at"` // Date and time when the associated fine-grained personal access token was last used for authentication. - Token_id int `json:"token_id"` // Unique identifier of the user's token. This field can also be found in audit log events and the organization's settings for their PAT grants. - Access_granted_at string `json:"access_granted_at"` // Date and time when the fine-grained personal access token was approved to access the organization. - Permissions map[string]interface{} `json:"permissions"` // Permissions requested, categorized by type of permission. - Repositories_url string `json:"repositories_url"` // URL to the list of repositories the fine-grained personal access token can access. Only follow when `repository_selection` is `subset`. +// GeneratedType_Webhook_issues_deleted represents the GeneratedType_Webhook_issues_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_issues_deleted struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Editors []map[string]interface{} `json:"editors,omitempty"` - Total_engaged_users int `json:"total_engaged_users,omitempty"` // Total number of users who prompted Copilot Chat in the IDE. +// Release represents the Release schema from the OpenAPI specification +type Release struct { + Html_url string `json:"html_url"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Upload_url string `json:"upload_url"` + Author GeneratedType_Simple_user `json:"author"` // A GitHub user. + Published_at string `json:"published_at"` + Tag_name string `json:"tag_name"` // The name of the tag. + Mentions_count int `json:"mentions_count,omitempty"` + Target_commitish string `json:"target_commitish"` // Specifies the commitish value that determines where the Git tag is created from. + Body string `json:"body,omitempty"` + Body_text string `json:"body_text,omitempty"` + Created_at string `json:"created_at"` + Discussion_url string `json:"discussion_url,omitempty"` // The URL of the release discussion. + Name string `json:"name"` + Prerelease bool `json:"prerelease"` // Whether to identify the release as a prerelease or a full release. + Assets_url string `json:"assets_url"` + Body_html string `json:"body_html,omitempty"` + Tarball_url string `json:"tarball_url"` + Id int `json:"id"` + Node_id string `json:"node_id"` + Url string `json:"url"` + Zipball_url string `json:"zipball_url"` + Draft bool `json:"draft"` // true to create a draft (unpublished) release, false to create a published one. + Assets []GeneratedType_Release_asset `json:"assets"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_issue_comment_created represents the GeneratedType_Webhook_issue_comment_created schema from the OpenAPI specification +type GeneratedType_Webhook_issue_comment_created struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Definition GeneratedType `json:"definition"` // Custom property defined on an organization - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. + Comment map[string]interface{} `json:"comment"` // The [comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) the comment belongs to. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Source string `json:"source"` - Name string `json:"name"` +// GeneratedType_Org_repo_custom_property_values represents the GeneratedType_Org_repo_custom_property_values schema from the OpenAPI specification +type GeneratedType_Org_repo_custom_property_values struct { + Properties []GeneratedType_Custom_property_value `json:"properties"` // List of custom property names and associated values + Repository_full_name string `json:"repository_full_name"` + Repository_id int `json:"repository_id"` + Repository_name string `json:"repository_name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Author map[string]interface{} `json:"author"` // Identifying information for the git-user - Html_url string `json:"html_url"` - Message string `json:"message"` // Message describing the purpose of the commit - Node_id string `json:"node_id"` - Sha string `json:"sha"` // SHA for the commit - Tree map[string]interface{} `json:"tree"` - Committer map[string]interface{} `json:"committer"` // Identifying information for the git-user - Parents []map[string]interface{} `json:"parents"` +// GeneratedType_Marketplace_purchase represents the GeneratedType_Marketplace_purchase schema from the OpenAPI specification +type GeneratedType_Marketplace_purchase struct { + Marketplace_pending_change map[string]interface{} `json:"marketplace_pending_change,omitempty"` + Marketplace_purchase map[string]interface{} `json:"marketplace_purchase"` + Organization_billing_email string `json:"organization_billing_email,omitempty"` + TypeField string `json:"type"` Url string `json:"url"` - Verification map[string]interface{} `json:"verification"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Completed int `json:"completed"` - Percent_completed int `json:"percent_completed"` - Total int `json:"total"` + Email string `json:"email,omitempty"` + Id int `json:"id"` + Login string `json:"login"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_job interface{} `json:"workflow_job"` +// Import represents the Import schema from the OpenAPI specification +type Import struct { + Large_files_count int `json:"large_files_count,omitempty"` + Large_files_size int `json:"large_files_size,omitempty"` + Status string `json:"status"` + Import_percent int `json:"import_percent,omitempty"` + Use_lfs bool `json:"use_lfs,omitempty"` + Commit_count int `json:"commit_count,omitempty"` + Push_percent int `json:"push_percent,omitempty"` + Project_choices []map[string]interface{} `json:"project_choices,omitempty"` + Repository_url string `json:"repository_url"` + Svc_root string `json:"svc_root,omitempty"` + Vcs_url string `json:"vcs_url"` // The URL of the originating repository. + Failed_step string `json:"failed_step,omitempty"` + Tfvc_project string `json:"tfvc_project,omitempty"` + Vcs string `json:"vcs"` + Authors_count int `json:"authors_count,omitempty"` + Message string `json:"message,omitempty"` + Has_large_files bool `json:"has_large_files,omitempty"` + Error_message string `json:"error_message,omitempty"` + Html_url string `json:"html_url"` + Status_text string `json:"status_text,omitempty"` + Authors_url string `json:"authors_url"` + Svn_root string `json:"svn_root,omitempty"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Has_multiple_single_files bool `json:"has_multiple_single_files,omitempty"` - Permissions GeneratedType `json:"permissions"` // The permissions granted to the user access token. - Repositories_url string `json:"repositories_url"` - Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved - Single_file_name string `json:"single_file_name"` - Single_file_paths []string `json:"single_file_paths,omitempty"` - Account GeneratedType `json:"account"` // A GitHub user. +// Job represents the Job schema from the OpenAPI specification +type Job struct { + Name string `json:"name"` // The name of the job. + Run_id int `json:"run_id"` // The id of the associated workflow run. + Html_url string `json:"html_url"` + Created_at string `json:"created_at"` // The time that the job created, in ISO 8601 format. + Node_id string `json:"node_id"` + Started_at string `json:"started_at"` // The time that the job started, in ISO 8601 format. + Steps []map[string]interface{} `json:"steps,omitempty"` // Steps in this job. + Workflow_name string `json:"workflow_name"` // The name of the workflow. + Head_sha string `json:"head_sha"` // The SHA of the commit that is being run. + Check_run_url string `json:"check_run_url"` + Completed_at string `json:"completed_at"` // The time that the job finished, in ISO 8601 format. + Runner_group_id int `json:"runner_group_id"` // The ID of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) + Head_branch string `json:"head_branch"` // The name of the current branch. + Url string `json:"url"` + Conclusion string `json:"conclusion"` // The outcome of the job. + Run_attempt int `json:"run_attempt,omitempty"` // Attempt number of the associated workflow run, 1 for first attempt and higher if the workflow was re-run. + Labels []string `json:"labels"` // Labels for the workflow job. Specified by the "runs_on" attribute in the action's workflow file. + Status string `json:"status"` // The phase of the lifecycle that the job is currently in. + Id int `json:"id"` // The id of the job. + Run_url string `json:"run_url"` + Runner_group_name string `json:"runner_group_name"` // The name of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) + Runner_id int `json:"runner_id"` // The ID of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) + Runner_name string `json:"runner_name"` // The name of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.) } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Sponsorship Webhookssponsorship `json:"sponsorship"` +// GeneratedType_Webhook_pull_request_dequeued represents the GeneratedType_Webhook_pull_request_dequeued schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_dequeued struct { + Reason string `json:"reason"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes Webhookschanges8 `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Pull_request_minimal represents the GeneratedType_Pull_request_minimal schema from the OpenAPI specification +type GeneratedType_Pull_request_minimal struct { + Base map[string]interface{} `json:"base"` + Head map[string]interface{} `json:"head"` + Id int64 `json:"id"` + Number int `json:"number"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Documentation string `json:"documentation"` +// GeneratedType_Base_gist represents the GeneratedType_Base_gist schema from the OpenAPI specification +type GeneratedType_Base_gist struct { Files map[string]interface{} `json:"files"` - Health_percentage int `json:"health_percentage"` + Html_url string `json:"html_url"` Updated_at string `json:"updated_at"` - Content_reports_enabled bool `json:"content_reports_enabled,omitempty"` - Description string `json:"description"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_column Webhooksprojectcolumn `json:"project_column"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` -} - -// Status represents the Status schema from the OpenAPI specification -type Status struct { - Context string `json:"context"` - Description string `json:"description"` - Id int `json:"id"` - Creator GeneratedType `json:"creator"` // A GitHub user. + History []interface{} `json:"history,omitempty"` Node_id string `json:"node_id"` - Updated_at string `json:"updated_at"` Url string `json:"url"` - Avatar_url string `json:"avatar_url"` + Comments_enabled bool `json:"comments_enabled,omitempty"` + Comments_url string `json:"comments_url"` + Public bool `json:"public"` + Git_push_url string `json:"git_push_url"` + Owner GeneratedType_Simple_user `json:"owner,omitempty"` // A GitHub user. + Description string `json:"description"` + Forks_url string `json:"forks_url"` + Truncated bool `json:"truncated,omitempty"` + Commits_url string `json:"commits_url"` + Id string `json:"id"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. Created_at string `json:"created_at"` - State string `json:"state"` - Target_url string `json:"target_url"` + Comments int `json:"comments"` + Forks []interface{} `json:"forks,omitempty"` + Git_pull_url string `json:"git_pull_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Push_protection_bypass_request_reviewer_comment string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` // An optional comment when reviewing a push protection bypass. - Push_protection_bypassed_by GeneratedType `json:"push_protection_bypassed_by,omitempty"` // A GitHub user. - Resolved_at string `json:"resolved_at,omitempty"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Has_more_locations bool `json:"has_more_locations,omitempty"` // A boolean value representing whether or not the token in the alert was detected in more than one location. - Push_protection_bypass_request_comment string `json:"push_protection_bypass_request_comment,omitempty"` // An optional comment when requesting a push protection bypass. - First_location_detected interface{} `json:"first_location_detected,omitempty"` // Details on the location where the token was initially detected. This can be a commit, wiki commit, issue, discussion, pull request. - Push_protection_bypassed_at string `json:"push_protection_bypassed_at,omitempty"` // The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Secret_type_display_name string `json:"secret_type_display_name,omitempty"` // User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)." - Html_url string `json:"html_url,omitempty"` // The GitHub URL of the alert resource. - Publicly_leaked bool `json:"publicly_leaked,omitempty"` // Whether the detected secret was publicly leaked. - Push_protection_bypass_request_reviewer GeneratedType `json:"push_protection_bypass_request_reviewer,omitempty"` // A GitHub user. - Resolution_comment string `json:"resolution_comment,omitempty"` // An optional comment to resolve an alert. - Secret_type string `json:"secret_type,omitempty"` // The type of secret that secret scanning detected. - Created_at string `json:"created_at,omitempty"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Is_base64_encoded bool `json:"is_base64_encoded,omitempty"` // A boolean value representing whether or not alert is base64 encoded - State string `json:"state,omitempty"` // Sets the state of the secret scanning alert. You must provide `resolution` when you set the state to `resolved`. - Validity string `json:"validity,omitempty"` // The token status as of the latest validity check. - Resolved_by GeneratedType `json:"resolved_by,omitempty"` // A GitHub user. - Secret string `json:"secret,omitempty"` // The secret that was detected. - Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Number int `json:"number,omitempty"` // The security alert number. - Url string `json:"url,omitempty"` // The REST API URL of the alert resource. - Multi_repo bool `json:"multi_repo,omitempty"` // Whether the detected secret was found in multiple repositories under the same organization or enterprise. - Locations_url string `json:"locations_url,omitempty"` // The REST API URL of the code locations for this alert. - Resolution string `json:"resolution,omitempty"` // **Required when the `state` is `resolved`.** The reason for resolving the alert. - Push_protection_bypassed bool `json:"push_protection_bypassed,omitempty"` // Whether push protection was bypassed for the detected secret. - Push_protection_bypass_request_html_url string `json:"push_protection_bypass_request_html_url,omitempty"` // The URL to a push protection bypass request. +// GeneratedType_Webhook_projects_v2_project_deleted represents the GeneratedType_Webhook_projects_v2_project_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_project_deleted struct { + Action string `json:"action"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2 GeneratedType_Projects_v2 `json:"projects_v2"` // A projects v2 project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request_title_url string `json:"pull_request_title_url"` // The API URL to get the pull request where the secret was detected. +// GeneratedType_Webhook_discussion_edited represents the GeneratedType_Webhook_discussion_edited schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_edited struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes,omitempty"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Summary string `json:"summary,omitempty"` // A short summary of the advisory. - Collaborating_teams []string `json:"collaborating_teams,omitempty"` // A list of team slugs which have been granted write access to the advisory. - Collaborating_users []string `json:"collaborating_users,omitempty"` // A list of usernames who have been granted write access to the advisory. - Description string `json:"description,omitempty"` // A detailed description of what the advisory impacts. - State string `json:"state,omitempty"` // The state of the advisory. - Cvss_vector_string string `json:"cvss_vector_string,omitempty"` // The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`. - Vulnerabilities []map[string]interface{} `json:"vulnerabilities,omitempty"` // A product affected by the vulnerability detailed in a repository security advisory. - Cve_id string `json:"cve_id,omitempty"` // The Common Vulnerabilities and Exposures (CVE) ID. - Severity string `json:"severity,omitempty"` // The severity of the advisory. You must choose between setting this field or `cvss_vector_string`. - Credits []map[string]interface{} `json:"credits,omitempty"` // A list of users receiving credit for their participation in the security advisory. - Cwe_ids []string `json:"cwe_ids,omitempty"` // A list of Common Weakness Enumeration (CWE) IDs. +// GeneratedType_Webhook_discussion_category_changed represents the GeneratedType_Webhook_discussion_category_changed schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_category_changed struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation Installation `json:"installation"` // Installation - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requester interface{} `json:"requester,omitempty"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// License represents the License schema from the OpenAPI specification +type License struct { + Body string `json:"body"` + Permissions []string `json:"permissions"` + Name string `json:"name"` + Node_id string `json:"node_id"` + Conditions []string `json:"conditions"` + Featured bool `json:"featured"` + Implementation string `json:"implementation"` + Key string `json:"key"` + Url string `json:"url"` + Description string `json:"description"` + Html_url string `json:"html_url"` + Limitations []string `json:"limitations"` + Spdx_id string `json:"spdx_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Start_private_fork bool `json:"start_private_fork,omitempty"` // Whether to create a temporary private fork of the repository to collaborate on a fix. - Summary string `json:"summary"` // A short summary of the advisory. - Vulnerabilities []map[string]interface{} `json:"vulnerabilities,omitempty"` // An array of products affected by the vulnerability detailed in a repository security advisory. - Cvss_vector_string string `json:"cvss_vector_string,omitempty"` // The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`. - Cwe_ids []string `json:"cwe_ids,omitempty"` // A list of Common Weakness Enumeration (CWE) IDs. - Description string `json:"description"` // A detailed description of what the advisory impacts. - Severity string `json:"severity,omitempty"` // The severity of the advisory. You must choose between setting this field or `cvss_vector_string`. +// GeneratedType_Team_full represents the GeneratedType_Team_full schema from the OpenAPI specification +type GeneratedType_Team_full struct { + Repositories_url string `json:"repositories_url"` + Node_id string `json:"node_id"` + Members_count int `json:"members_count"` + Privacy string `json:"privacy,omitempty"` // The level of privacy this team should have + Description string `json:"description"` + Created_at string `json:"created_at"` + Id int `json:"id"` // Unique identifier of the team + Members_url string `json:"members_url"` + Html_url string `json:"html_url"` + Url string `json:"url"` // URL for the team + Ldap_dn string `json:"ldap_dn,omitempty"` // Distinguished Name (DN) that team maps to within LDAP environment + Name string `json:"name"` // Name of the team + Permission string `json:"permission"` // Permission that the team will have for its repositories + Repos_count int `json:"repos_count"` + Parent GeneratedType_Nullable_team_simple `json:"parent,omitempty"` // Groups of organization members that gives permissions on specified repositories. + Organization GeneratedType_Team_organization `json:"organization"` // Team Organization + Updated_at string `json:"updated_at"` + Notification_setting string `json:"notification_setting,omitempty"` // The notification setting the team has set + Slug string `json:"slug"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Repository_ruleset_conditions_repository_id_target represents the GeneratedType_Repository_ruleset_conditions_repository_id_target schema from the OpenAPI specification +type GeneratedType_Repository_ruleset_conditions_repository_id_target struct { + Repository_id map[string]interface{} `json:"repository_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Documentation_url string `json:"documentation_url"` - Errors []string `json:"errors,omitempty"` - Message string `json:"message"` +// GeneratedType_Repository_ruleset_conditions_repository_property_target represents the GeneratedType_Repository_ruleset_conditions_repository_property_target schema from the OpenAPI specification +type GeneratedType_Repository_ruleset_conditions_repository_property_target struct { + Repository_property map[string]interface{} `json:"repository_property"` } -// Discussion represents the Discussion schema from the OpenAPI specification -type Discussion struct { - Active_lock_reason string `json:"active_lock_reason"` - Locked bool `json:"locked"` - Timeline_url string `json:"timeline_url,omitempty"` - Created_at string `json:"created_at"` +// Webhookscomment represents the Webhookscomment schema from the OpenAPI specification +type Webhookscomment struct { + Parent_id int `json:"parent_id"` + Html_url string `json:"html_url"` Node_id string `json:"node_id"` - Labels []Label `json:"labels,omitempty"` + Reactions map[string]interface{} `json:"reactions"` + Updated_at string `json:"updated_at"` User map[string]interface{} `json:"user"` - Body string `json:"body"` - Reactions map[string]interface{} `json:"reactions,omitempty"` + Created_at string `json:"created_at"` + Discussion_id int `json:"discussion_id"` + Repository_url string `json:"repository_url"` Author_association string `json:"author_association"` // How the author is associated with the repository. - Answer_html_url string `json:"answer_html_url"` - Comments int `json:"comments"` - Html_url string `json:"html_url"` - Answer_chosen_by map[string]interface{} `json:"answer_chosen_by"` - Category map[string]interface{} `json:"category"` - State_reason string `json:"state_reason"` // The reason for the current state - Title string `json:"title"` + Body string `json:"body"` + Child_comment_count int `json:"child_comment_count"` Id int `json:"id"` - State string `json:"state"` // The current state of the discussion. `converting` means that the discussion is being converted from an issue. `transferring` means that the discussion is being transferred from another repository. - Repository_url string `json:"repository_url"` - Updated_at string `json:"updated_at"` - Answer_chosen_at string `json:"answer_chosen_at"` - Number int `json:"number"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Security_advisory Webhookssecurityadvisory `json:"security_advisory"` // The details of the security advisory, including summary, description, and severity. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Submitted bool `json:"submitted"` // Whether an accepted assignment has been submitted. - Assignment GeneratedType `json:"assignment"` // A GitHub Classroom assignment - Commit_count int `json:"commit_count"` // Count of student commits. - Grade string `json:"grade"` // Most recent grade. - Id int `json:"id"` // Unique identifier of the repository. - Passing bool `json:"passing"` // Whether a submission passed. - Repository GeneratedType `json:"repository"` // A GitHub repository view for Classroom - Students []GeneratedType `json:"students"` +// GeneratedType_Webhook_repository_dispatch_sample represents the GeneratedType_Webhook_repository_dispatch_sample schema from the OpenAPI specification +type GeneratedType_Webhook_repository_dispatch_sample struct { + Branch string `json:"branch"` + Client_payload map[string]interface{} `json:"client_payload"` // The `client_payload` that was specified in the `POST /repos/{owner}/{repo}/dispatches` request body. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` // The `event_type` that was specified in the `POST /repos/{owner}/{repo}/dispatches` request body. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Color string `json:"color,omitempty"` - Description string `json:"description,omitempty"` - Id string `json:"id"` - Name string `json:"name"` +// GeneratedType_Repository_rule represents the GeneratedType_Repository_rule schema from the OpenAPI specification +type GeneratedType_Repository_rule struct { } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Pull_request_simple represents the GeneratedType_Pull_request_simple schema from the OpenAPI specification +type GeneratedType_Pull_request_simple struct { + Commits_url string `json:"commits_url"` + Issue_url string `json:"issue_url"` + State string `json:"state"` + Title string `json:"title"` + Head map[string]interface{} `json:"head"` + Requested_teams []Team `json:"requested_teams,omitempty"` + Active_lock_reason string `json:"active_lock_reason,omitempty"` + Body string `json:"body"` + Html_url string `json:"html_url"` + Comments_url string `json:"comments_url"` + Review_comment_url string `json:"review_comment_url"` Updated_at string `json:"updated_at"` - Username string `json:"username,omitempty"` // The username to use when authenticating with the private registry. - Visibility string `json:"visibility"` // Which type of organization repositories have access to the private registry. `selected` means only the repositories specified by `selected_repository_ids` can access the private registry. + Id int64 `json:"id"` + Auto_merge GeneratedType_Auto_merge `json:"auto_merge"` // The status of auto merging a pull request. + Assignee GeneratedType_Nullable_simple_user `json:"assignee"` // A GitHub user. + Requested_reviewers []GeneratedType_Simple_user `json:"requested_reviewers,omitempty"` + Node_id string `json:"node_id"` + Statuses_url string `json:"statuses_url"` + Draft bool `json:"draft,omitempty"` // Indicates whether or not the pull request is a draft. + Milestone GeneratedType_Nullable_milestone `json:"milestone"` // A collection of related issues and pull requests. + Assignees []GeneratedType_Simple_user `json:"assignees,omitempty"` + Review_comments_url string `json:"review_comments_url"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Merge_commit_sha string `json:"merge_commit_sha"` + Links map[string]interface{} `json:"_links"` + Labels []map[string]interface{} `json:"labels"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + Url string `json:"url"` + Number int `json:"number"` Created_at string `json:"created_at"` - Name string `json:"name"` // The name of the private registry configuration. - Registry_type string `json:"registry_type"` // The registry type. - Selected_repository_ids []int `json:"selected_repository_ids,omitempty"` // An array of repository IDs that can access the organization private registry when `visibility` is set to `selected`. + Locked bool `json:"locked"` + Closed_at string `json:"closed_at"` + Merged_at string `json:"merged_at"` + Base map[string]interface{} `json:"base"` + Patch_url string `json:"patch_url"` + Diff_url string `json:"diff_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_sub_issues_parent_issue_added represents the GeneratedType_Webhook_sub_issues_parent_issue_added schema from the OpenAPI specification +type GeneratedType_Webhook_sub_issues_parent_issue_added struct { + Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project_column Webhooksprojectcolumn `json:"project_column"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Parent_issue_repo Repository `json:"parent_issue_repo"` // A repository on GitHub. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_milestone_deleted represents the GeneratedType_Webhook_milestone_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_milestone_deleted struct { Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Domains []string `json:"domains"` // Array of the domain set and its alternate name (if it is configured) - Expires_at string `json:"expires_at,omitempty"` - State string `json:"state"` - Description string `json:"description"` +// Webhooksdeploykey represents the Webhooksdeploykey schema from the OpenAPI specification +type Webhooksdeploykey struct { + Id int `json:"id"` + Key string `json:"key"` + Read_only bool `json:"read_only"` + Title string `json:"title"` + Verified bool `json:"verified"` + Enabled bool `json:"enabled,omitempty"` + Last_used string `json:"last_used,omitempty"` + Created_at string `json:"created_at"` + Added_by string `json:"added_by,omitempty"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Accessible_repositories []GeneratedType `json:"accessible_repositories,omitempty"` - Default_level string `json:"default_level,omitempty"` // The default repository access level for Dependabot updates. +// Contributor represents the Contributor schema from the OpenAPI specification +type Contributor struct { + Html_url string `json:"html_url,omitempty"` + TypeField string `json:"type"` + User_view_type string `json:"user_view_type,omitempty"` + Node_id string `json:"node_id,omitempty"` + Url string `json:"url,omitempty"` + Email string `json:"email,omitempty"` + Site_admin bool `json:"site_admin,omitempty"` + Avatar_url string `json:"avatar_url,omitempty"` + Following_url string `json:"following_url,omitempty"` + Events_url string `json:"events_url,omitempty"` + Gravatar_id string `json:"gravatar_id,omitempty"` + Starred_url string `json:"starred_url,omitempty"` + Received_events_url string `json:"received_events_url,omitempty"` + Followers_url string `json:"followers_url,omitempty"` + Contributions int `json:"contributions"` + Id int `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Gists_url string `json:"gists_url,omitempty"` + Login string `json:"login,omitempty"` + Organizations_url string `json:"organizations_url,omitempty"` + Repos_url string `json:"repos_url,omitempty"` + Subscriptions_url string `json:"subscriptions_url,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Key string `json:"key"` // The Base64 encoded public key. - Key_id string `json:"key_id"` // The identifier for the key. +// GeneratedType_Interaction_limit represents the GeneratedType_Interaction_limit schema from the OpenAPI specification +type GeneratedType_Interaction_limit struct { + Expiry string `json:"expiry,omitempty"` // The duration of the interaction restriction. Default: `one_day`. + Limit string `json:"limit"` // The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_project_created represents the GeneratedType_Webhook_project_created schema from the OpenAPI specification +type GeneratedType_Webhook_project_created struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project Webhooksproject `json:"project"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// Link represents the Link schema from the OpenAPI specification -type Link struct { - Href string `json:"href"` +// GeneratedType_Git_tag represents the GeneratedType_Git_tag schema from the OpenAPI specification +type GeneratedType_Git_tag struct { + Node_id string `json:"node_id"` + Object map[string]interface{} `json:"object"` + Sha string `json:"sha"` + Tag string `json:"tag"` // Name of the tag + Tagger map[string]interface{} `json:"tagger"` + Url string `json:"url"` // URL for the tag + Verification Verification `json:"verification,omitempty"` + Message string `json:"message"` // Message describing the purpose of the tag } // Webhooksprojectcard represents the Webhooksprojectcard schema from the OpenAPI specification type Webhooksprojectcard struct { - Note string `json:"note"` - Updated_at string `json:"updated_at"` - Creator map[string]interface{} `json:"creator"` - Id int `json:"id"` // The project card's ID - Project_url string `json:"project_url"` - Url string `json:"url"` + After_id int `json:"after_id,omitempty"` + Column_id int `json:"column_id"` Column_url string `json:"column_url"` Content_url string `json:"content_url,omitempty"` Created_at string `json:"created_at"` - After_id int `json:"after_id,omitempty"` - Archived bool `json:"archived"` // Whether or not the card is archived + Id int `json:"id"` // The project card's ID Node_id string `json:"node_id"` - Column_id int `json:"column_id"` + Note string `json:"note"` + Archived bool `json:"archived"` // Whether or not the card is archived + Creator map[string]interface{} `json:"creator"` + Project_url string `json:"project_url"` + Updated_at string `json:"updated_at"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Copilot_dotcom_pull_requests GeneratedType `json:"copilot_dotcom_pull_requests,omitempty"` // Usage metrics for Copilot for pull requests. - Copilot_ide_chat GeneratedType `json:"copilot_ide_chat,omitempty"` // Usage metrics for Copilot Chat in the IDE. - Copilot_ide_code_completions GeneratedType `json:"copilot_ide_code_completions,omitempty"` // Usage metrics for Copilot editor code completions in the IDE. - Date string `json:"date"` // The date for which the usage metrics are aggregated, in `YYYY-MM-DD` format. - Total_active_users int `json:"total_active_users,omitempty"` // The total number of Copilot users with activity belonging to any Copilot feature, globally, for the given day. Includes passive activity such as receiving a code suggestion, as well as engagement activity such as accepting a code suggestion or prompting chat. Does not include authentication events. Is not limited to the individual features detailed on the endpoint. - Total_engaged_users int `json:"total_engaged_users,omitempty"` // The total number of Copilot users who engaged with any Copilot feature, for the given day. Examples include but are not limited to accepting a code suggestion, prompting Copilot chat, or triggering a PR Summary. Does not include authentication events. Is not limited to the individual features detailed on the endpoint. - Copilot_dotcom_chat GeneratedType `json:"copilot_dotcom_chat,omitempty"` // Usage metrics for Copilot Chat in GitHub.com +// GeneratedType_Webhook_member_edited represents the GeneratedType_Webhook_member_edited schema from the OpenAPI specification +type GeneratedType_Webhook_member_edited struct { + Member Webhooksuser `json:"member"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` // The changes to the collaborator permissions + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Base_commit Commit `json:"base_commit"` // Commit - Diff_url string `json:"diff_url"` - Merge_base_commit Commit `json:"merge_base_commit"` // Commit - Status string `json:"status"` - Url string `json:"url"` - Total_commits int `json:"total_commits"` - Commits []Commit `json:"commits"` - Html_url string `json:"html_url"` - Permalink_url string `json:"permalink_url"` - Ahead_by int `json:"ahead_by"` - Behind_by int `json:"behind_by"` - Files []GeneratedType `json:"files,omitempty"` - Patch_url string `json:"patch_url"` +// GeneratedType_Code_security_configuration represents the GeneratedType_Code_security_configuration schema from the OpenAPI specification +type GeneratedType_Code_security_configuration struct { + Secret_scanning_delegated_bypass string `json:"secret_scanning_delegated_bypass,omitempty"` // The enablement status of secret scanning delegated bypass + Updated_at string `json:"updated_at,omitempty"` + Dependency_graph_autosubmit_action string `json:"dependency_graph_autosubmit_action,omitempty"` // The enablement status of Automatic dependency submission + Enforcement string `json:"enforcement,omitempty"` // The enforcement status for a security configuration + Secret_scanning_non_provider_patterns string `json:"secret_scanning_non_provider_patterns,omitempty"` // The enablement status of secret scanning non-provider patterns + Code_scanning_delegated_alert_dismissal string `json:"code_scanning_delegated_alert_dismissal,omitempty"` // The enablement status of code scanning delegated alert dismissal + Secret_scanning_push_protection string `json:"secret_scanning_push_protection,omitempty"` // The enablement status of secret scanning push protection + Advanced_security string `json:"advanced_security,omitempty"` // The enablement status of GitHub Advanced Security + Code_scanning_default_setup string `json:"code_scanning_default_setup,omitempty"` // The enablement status of code scanning default setup + Code_scanning_options map[string]interface{} `json:"code_scanning_options,omitempty"` // Feature options for code scanning + Dependency_graph_autosubmit_action_options map[string]interface{} `json:"dependency_graph_autosubmit_action_options,omitempty"` // Feature options for Automatic dependency submission + Description string `json:"description,omitempty"` // A description of the code security configuration + Secret_scanning_delegated_alert_dismissal string `json:"secret_scanning_delegated_alert_dismissal,omitempty"` // The enablement status of secret scanning delegated alert dismissal + Dependabot_alerts string `json:"dependabot_alerts,omitempty"` // The enablement status of Dependabot alerts + Secret_scanning string `json:"secret_scanning,omitempty"` // The enablement status of secret scanning + Secret_scanning_generic_secrets string `json:"secret_scanning_generic_secrets,omitempty"` // The enablement status of Copilot secret scanning + Dependabot_security_updates string `json:"dependabot_security_updates,omitempty"` // The enablement status of Dependabot security updates + Html_url string `json:"html_url,omitempty"` // The URL of the configuration + Name string `json:"name,omitempty"` // The name of the code security configuration. Must be unique within the organization. + Private_vulnerability_reporting string `json:"private_vulnerability_reporting,omitempty"` // The enablement status of private vulnerability reporting + Secret_scanning_delegated_bypass_options map[string]interface{} `json:"secret_scanning_delegated_bypass_options,omitempty"` // Feature options for secret scanning delegated bypass + Code_scanning_default_setup_options map[string]interface{} `json:"code_scanning_default_setup_options,omitempty"` // Feature options for code scanning default setup + Id int `json:"id,omitempty"` // The ID of the code security configuration + Target_type string `json:"target_type,omitempty"` // The type of the code security configuration. + Secret_scanning_validity_checks string `json:"secret_scanning_validity_checks,omitempty"` // The enablement status of secret scanning validity checks + Url string `json:"url,omitempty"` // The URL of the configuration + Created_at string `json:"created_at,omitempty"` + Dependency_graph string `json:"dependency_graph,omitempty"` // The enablement status of Dependency Graph } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Links map[string]interface{} `json:"_links"` - Download_url string `json:"download_url"` - Name string `json:"name"` - Path string `json:"path"` - Size int `json:"size"` - Content string `json:"content,omitempty"` - Encoding string `json:"encoding,omitempty"` - Git_url string `json:"git_url"` - Sha string `json:"sha"` - Url string `json:"url"` - Entries []map[string]interface{} `json:"entries,omitempty"` - Html_url string `json:"html_url"` - TypeField string `json:"type"` +// GeneratedType_Webhook_issues_assigned represents the GeneratedType_Webhook_issues_assigned schema from the OpenAPI specification +type GeneratedType_Webhook_issues_assigned struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` // The action that was performed. + Assignee Webhooksuser `json:"assignee,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Comment Webhooksissuecomment `json:"comment"` // The [comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment) itself. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) the comment belongs to. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes Webhookschanges `json:"changes"` // The changes to the comment. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Campaign_summary represents the GeneratedType_Campaign_summary schema from the OpenAPI specification +type GeneratedType_Campaign_summary struct { + Description string `json:"description"` // The campaign description + State string `json:"state"` // Indicates whether a campaign is open or closed + Closed_at string `json:"closed_at,omitempty"` // The date and time the campaign was closed, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. Will be null if the campaign is still open. + Published_at string `json:"published_at,omitempty"` // The date and time the campaign was published, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Team_managers []Team `json:"team_managers,omitempty"` // The campaign team managers + Managers []GeneratedType_Simple_user `json:"managers"` // The campaign managers + Name string `json:"name,omitempty"` // The campaign name + Updated_at string `json:"updated_at"` // The date and time the campaign was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Ends_at string `json:"ends_at"` // The date and time the campaign has ended, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Number int `json:"number"` // The number of the newly created campaign + Alert_stats map[string]interface{} `json:"alert_stats,omitempty"` + Contact_link string `json:"contact_link"` // The contact link of the campaign. + Created_at string `json:"created_at"` // The date and time the campaign was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Deployment_branch_policy_settings represents the GeneratedType_Deployment_branch_policy_settings schema from the OpenAPI specification +type GeneratedType_Deployment_branch_policy_settings struct { + Custom_branch_policies bool `json:"custom_branch_policies"` // Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`. + Protected_branches bool `json:"protected_branches"` // Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` // The changes to the project if the action was `edited`. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Project Webhooksproject `json:"project"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Actions_public_key represents the GeneratedType_Actions_public_key schema from the OpenAPI specification +type GeneratedType_Actions_public_key struct { + Key_id string `json:"key_id"` // The identifier for the key. + Title string `json:"title,omitempty"` + Url string `json:"url,omitempty"` + Created_at string `json:"created_at,omitempty"` + Id int `json:"id,omitempty"` + Key string `json:"key"` // The Base64 encoded public key. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Review map[string]interface{} `json:"review"` // The review that was affected. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Codespace_with_full_repository represents the GeneratedType_Codespace_with_full_repository schema from the OpenAPI specification +type GeneratedType_Codespace_with_full_repository struct { + Idle_timeout_minutes int `json:"idle_timeout_minutes"` // The number of minutes of inactivity after which this codespace will be automatically stopped. + Updated_at string `json:"updated_at"` + Pending_operation bool `json:"pending_operation,omitempty"` // Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it. + Retention_period_minutes int `json:"retention_period_minutes,omitempty"` // Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). + Id int64 `json:"id"` + Pending_operation_disabled_reason string `json:"pending_operation_disabled_reason,omitempty"` // Text to show user when codespace is disabled by a pending operation + Location string `json:"location"` // The initally assigned location of a new codespace. + Created_at string `json:"created_at"` + Git_status map[string]interface{} `json:"git_status"` // Details about the codespace's git repository. + Url string `json:"url"` // API URL for this codespace. + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Web_url string `json:"web_url"` // URL to access this codespace on the web. + Pulls_url string `json:"pulls_url"` // API URL for the Pull Request associated with this codespace, if any. + Name string `json:"name"` // Automatically generated name of this codespace. + Publish_url string `json:"publish_url,omitempty"` // API URL to publish this codespace to a new repository. + Machines_url string `json:"machines_url"` // API URL to access available alternate machine types for this codespace. + Machine GeneratedType_Nullable_codespace_machine `json:"machine"` // A description of the machine powering a codespace. + Display_name string `json:"display_name,omitempty"` // Display name for this codespace. + Prebuild bool `json:"prebuild"` // Whether the codespace was created from a prebuild. + Last_used_at string `json:"last_used_at"` // Last known time this codespace was started. + Retention_expires_at string `json:"retention_expires_at,omitempty"` // When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at" + Start_url string `json:"start_url"` // API URL to start this codespace. + Environment_id string `json:"environment_id"` // UUID identifying this codespace's environment. + State string `json:"state"` // State of this codespace. + Devcontainer_path string `json:"devcontainer_path,omitempty"` // Path to devcontainer.json from repo root used to create Codespace. + Runtime_constraints map[string]interface{} `json:"runtime_constraints,omitempty"` + Stop_url string `json:"stop_url"` // API URL to stop this codespace. + Billable_owner GeneratedType_Simple_user `json:"billable_owner"` // A GitHub user. + Idle_timeout_notice string `json:"idle_timeout_notice,omitempty"` // Text to show user when codespace idle timeout minutes has been overriden by an organization policy + Repository GeneratedType_Full_repository `json:"repository"` // Full Repository + Recent_folders []string `json:"recent_folders"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Dismissal_message string `json:"dismissal_message"` - Review_id int `json:"review_id"` - State string `json:"state"` - Dismissal_commit_id string `json:"dismissal_commit_id,omitempty"` +// GeneratedType_Webhook_marketplace_purchase_pending_change represents the GeneratedType_Webhook_marketplace_purchase_pending_change schema from the OpenAPI specification +type GeneratedType_Webhook_marketplace_purchase_pending_change struct { + Effective_date string `json:"effective_date"` + Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Previous_marketplace_purchase map[string]interface{} `json:"previous_marketplace_purchase,omitempty"` + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// Team represents the Team schema from the OpenAPI specification -type Team struct { +// Webhooksanswer represents the Webhooksanswer schema from the OpenAPI specification +type Webhooksanswer struct { + Parent_id interface{} `json:"parent_id"` + Reactions map[string]interface{} `json:"reactions,omitempty"` + Body string `json:"body"` Node_id string `json:"node_id"` - Notification_setting string `json:"notification_setting,omitempty"` - Permission string `json:"permission"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Privacy string `json:"privacy,omitempty"` - Slug string `json:"slug"` - Url string `json:"url"` + Repository_url string `json:"repository_url"` + Updated_at string `json:"updated_at"` + User map[string]interface{} `json:"user"` + Author_association string `json:"author_association"` // How the author is associated with the repository. Html_url string `json:"html_url"` - Repositories_url string `json:"repositories_url"` - Description string `json:"description"` Id int `json:"id"` - Parent GeneratedType `json:"parent"` // Groups of organization members that gives permissions on specified repositories. - Members_url string `json:"members_url"` - Name string `json:"name"` + Child_comment_count int `json:"child_comment_count"` + Created_at string `json:"created_at"` + Discussion_id int `json:"discussion_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Rule Webhooksrule `json:"rule"` // The branch protection rule. Includes a `name` and all the [branch protection settings](https://docs.github.com/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-settings) applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of `off`, `non_admins`, or `everyone`. Actor and build lists are arrays of strings. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` // If the action was `edited`, the changes to the rule. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Repository_rule_max_file_path_length represents the GeneratedType_Repository_rule_max_file_path_length schema from the OpenAPI specification +type GeneratedType_Repository_rule_max_file_path_length struct { + TypeField string `json:"type"` + Parameters map[string]interface{} `json:"parameters,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Body_html string `json:"body_html,omitempty"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Issue_url string `json:"issue_url"` +// GeneratedType_Topic_search_result_item represents the GeneratedType_Topic_search_result_item schema from the OpenAPI specification +type GeneratedType_Topic_search_result_item struct { + Related []map[string]interface{} `json:"related,omitempty"` + Description string `json:"description"` + Logo_url string `json:"logo_url,omitempty"` + Repository_count int `json:"repository_count,omitempty"` + Featured bool `json:"featured"` + Score float64 `json:"score"` + Created_by string `json:"created_by"` + Curated bool `json:"curated"` + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` Updated_at string `json:"updated_at"` - Url string `json:"url"` // URL for the issue comment - Body string `json:"body,omitempty"` // Contents of the issue comment - Event string `json:"event"` - Author_association string `json:"author_association"` // How the author is associated with the repository. + Name string `json:"name"` + Released string `json:"released"` + Aliases []map[string]interface{} `json:"aliases,omitempty"` + Short_description string `json:"short_description"` Created_at string `json:"created_at"` - Id int `json:"id"` // Unique identifier of the issue comment - Body_text string `json:"body_text,omitempty"` - Node_id string `json:"node_id"` - Reactions GeneratedType `json:"reactions,omitempty"` - Html_url string `json:"html_url"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - User GeneratedType `json:"user"` // A GitHub user. + Display_name string `json:"display_name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_pull_request_review_comment_edited represents the GeneratedType_Webhook_pull_request_review_comment_edited schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_comment_edited struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. Action string `json:"action"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Comment Webhooksreviewcomment `json:"comment"` // The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Changes Webhookschanges `json:"changes"` // The changes to the comment. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Path string `json:"path"` - Ref string `json:"ref,omitempty"` - Sha string `json:"sha"` -} - -// Verification represents the Verification schema from the OpenAPI specification -type Verification struct { - Verified_at string `json:"verified_at"` - Payload string `json:"payload"` - Reason string `json:"reason"` - Signature string `json:"signature"` - Verified bool `json:"verified"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Percentage float64 `json:"percentage,omitempty"` - Percentile float64 `json:"percentile,omitempty"` +// GeneratedType_Api_insights_summary_stats represents the GeneratedType_Api_insights_summary_stats schema from the OpenAPI specification +type GeneratedType_Api_insights_summary_stats struct { + Rate_limited_request_count int64 `json:"rate_limited_request_count,omitempty"` // The total number of requests that were rate limited within the queried time period + Total_request_count int64 `json:"total_request_count,omitempty"` // The total number of requests within the queried time period } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Title string `json:"title"` +// GeneratedType_Webhook_project_deleted represents the GeneratedType_Webhook_project_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_project_deleted struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project Webhooksproject `json:"project"` + Repository GeneratedType_Nullable_repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. +// GeneratedType_Workflow_run_usage represents the GeneratedType_Workflow_run_usage schema from the OpenAPI specification +type GeneratedType_Workflow_run_usage struct { + Billable map[string]interface{} `json:"billable"` + Run_duration_ms int `json:"run_duration_ms,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actor GeneratedType `json:"actor"` // A GitHub user. - Event string `json:"event"` - Rename map[string]interface{} `json:"rename"` +// Webhooksprojectcolumn represents the Webhooksprojectcolumn schema from the OpenAPI specification +type Webhooksprojectcolumn struct { + Cards_url string `json:"cards_url"` + Created_at string `json:"created_at"` + Project_url string `json:"project_url"` Url string `json:"url"` - Commit_url string `json:"commit_url"` + Updated_at string `json:"updated_at"` + After_id int `json:"after_id,omitempty"` + Name string `json:"name"` // Name of the project column + Id int `json:"id"` // The unique identifier of the project column + Node_id string `json:"node_id"` +} + +// GeneratedType_Added_to_project_issue_event represents the GeneratedType_Added_to_project_issue_event schema from the OpenAPI specification +type GeneratedType_Added_to_project_issue_event struct { + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. Id int `json:"id"` Node_id string `json:"node_id"` Commit_id string `json:"commit_id"` + Project_card map[string]interface{} `json:"project_card,omitempty"` + Url string `json:"url"` Created_at string `json:"created_at"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Comment string `json:"comment"` // The comment submitted with the deployment review - Environments []map[string]interface{} `json:"environments"` // The list of environments that were approved or rejected - State string `json:"state"` // Whether deployment to the environment(s) was approved or rejected or pending (with comments) - User GeneratedType `json:"user"` // A GitHub user. + Event string `json:"event"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Commit_url string `json:"commit_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request_review_comment_url string `json:"pull_request_review_comment_url"` // The API URL to get the pull request review comment where the secret was detected. +// GeneratedType_Webhook_pull_request_unassigned represents the GeneratedType_Webhook_pull_request_unassigned schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_unassigned struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Number int `json:"number"` // The pull request number. + Assignee Webhooksusermannequin `json:"assignee,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Sender GeneratedType `json:"sender"` // A GitHub user. - Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_projects_v2_project_created represents the GeneratedType_Webhook_projects_v2_project_created schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_project_created struct { Action string `json:"action"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2 GeneratedType_Projects_v2 `json:"projects_v2"` // A projects v2 project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Discussion_body_url string `json:"discussion_body_url"` // The URL to the discussion where the secret was detected. +// GeneratedType_Repository_rule_tag_name_pattern represents the GeneratedType_Repository_rule_tag_name_pattern schema from the OpenAPI specification +type GeneratedType_Repository_rule_tag_name_pattern struct { + Parameters map[string]interface{} `json:"parameters,omitempty"` + TypeField string `json:"type"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Color string `json:"color,omitempty"` // Color for the issue type. - Description string `json:"description,omitempty"` // Description of the issue type. - Is_enabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. - Name string `json:"name"` // Name of the issue type. +// GeneratedType_Actions_variable represents the GeneratedType_Actions_variable schema from the OpenAPI specification +type GeneratedType_Actions_variable struct { + Name string `json:"name"` // The name of the variable. + Updated_at string `json:"updated_at"` // The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Value string `json:"value"` // The value of the variable. + Created_at string `json:"created_at"` // The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Protected bool `json:"protected"` - Commit map[string]interface{} `json:"commit"` - Name string `json:"name"` +// Snapshot represents the Snapshot schema from the OpenAPI specification +type Snapshot struct { + Detector map[string]interface{} `json:"detector"` // A description of the detector used. + Job map[string]interface{} `json:"job"` + Manifests map[string]interface{} `json:"manifests,omitempty"` // A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies. + Metadata Metadata `json:"metadata,omitempty"` // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. + Ref string `json:"ref"` // The repository branch that triggered this snapshot. + Scanned string `json:"scanned"` // The time at which the snapshot was scanned. + Sha string `json:"sha"` // The commit SHA associated with this dependency snapshot. Maximum length: 40 characters. + Version int `json:"version"` // The version of the repository snapshot submission. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Public_ips map[string]interface{} `json:"public_ips"` // Provides details of static public IP limits for GitHub-hosted Hosted Runners +// GeneratedType_Pending_deployment represents the GeneratedType_Pending_deployment schema from the OpenAPI specification +type GeneratedType_Pending_deployment struct { + Wait_timer int `json:"wait_timer"` // The set duration of the wait timer + Wait_timer_started_at string `json:"wait_timer_started_at"` // The time that the wait timer began. + Current_user_can_approve bool `json:"current_user_can_approve"` // Whether the currently authenticated user can approve the deployment + Environment map[string]interface{} `json:"environment"` + Reviewers []map[string]interface{} `json:"reviewers"` // The people or teams that may approve jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Languages []string `json:"languages,omitempty"` // Languages to be analyzed. - Query_suite string `json:"query_suite,omitempty"` // CodeQL query suite to be used. - Runner_label string `json:"runner_label,omitempty"` // Runner label to be used if the runner type is labeled. - Runner_type string `json:"runner_type,omitempty"` // Runner type to be used. - Schedule string `json:"schedule,omitempty"` // The frequency of the periodic analysis. - State string `json:"state,omitempty"` // Code scanning default setup has been configured or not. - Threat_model string `json:"threat_model,omitempty"` // Threat model to be used for code scanning analysis. Use `remote` to analyze only network sources and `remote_and_local` to include local sources like filesystem access, command-line arguments, database reads, environment variable and standard input. - Updated_at string `json:"updated_at,omitempty"` // Timestamp of latest configuration update. +// GeneratedType_Check_suite_preference represents the GeneratedType_Check_suite_preference schema from the OpenAPI specification +type GeneratedType_Check_suite_preference struct { + Preferences map[string]interface{} `json:"preferences"` + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sponsorship Webhookssponsorship `json:"sponsorship"` - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// Link represents the Link schema from the OpenAPI specification +type Link struct { + Href string `json:"href"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository map[string]interface{} `json:"repository,omitempty"` // A git repository - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. +// GeneratedType_Protected_branch_pull_request_review represents the GeneratedType_Protected_branch_pull_request_review schema from the OpenAPI specification +type GeneratedType_Protected_branch_pull_request_review struct { + Dismissal_restrictions map[string]interface{} `json:"dismissal_restrictions,omitempty"` + Require_code_owner_reviews bool `json:"require_code_owner_reviews"` + Require_last_push_approval bool `json:"require_last_push_approval,omitempty"` // Whether the most recent push must be approved by someone other than the person who pushed it. + Required_approving_review_count int `json:"required_approving_review_count,omitempty"` + Url string `json:"url,omitempty"` + Bypass_pull_request_allowances map[string]interface{} `json:"bypass_pull_request_allowances,omitempty"` // Allow specific users, teams, or apps to bypass pull request requirements. + Dismiss_stale_reviews bool `json:"dismiss_stale_reviews"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url"` - Repository GeneratedType `json:"repository"` // Minimal Repository - Url string `json:"url"` // URL for the repository invitation - Created_at string `json:"created_at"` - Invitee GeneratedType `json:"invitee"` // A GitHub user. - Id int64 `json:"id"` // Unique identifier of the repository invitation. - Inviter GeneratedType `json:"inviter"` // A GitHub user. - Node_id string `json:"node_id"` - Permissions string `json:"permissions"` // The permission associated with the invitation. - Expired bool `json:"expired,omitempty"` // Whether or not the invitation has expired +// GeneratedType_Organization_secret_scanning_alert represents the GeneratedType_Organization_secret_scanning_alert schema from the OpenAPI specification +type GeneratedType_Organization_secret_scanning_alert struct { + State string `json:"state,omitempty"` // Sets the state of the secret scanning alert. You must provide `resolution` when you set the state to `resolved`. + Url string `json:"url,omitempty"` // The REST API URL of the alert resource. + Publicly_leaked bool `json:"publicly_leaked,omitempty"` // Whether the secret was publicly leaked. + Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Push_protection_bypass_request_reviewer_comment string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` // An optional comment when reviewing a push protection bypass. + Repository GeneratedType_Simple_repository `json:"repository,omitempty"` // A GitHub repository. + Resolved_at string `json:"resolved_at,omitempty"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Resolved_by GeneratedType_Nullable_simple_user `json:"resolved_by,omitempty"` // A GitHub user. + Secret_type_display_name string `json:"secret_type_display_name,omitempty"` // User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)." + Number int `json:"number,omitempty"` // The security alert number. + Push_protection_bypass_request_comment string `json:"push_protection_bypass_request_comment,omitempty"` // An optional comment when requesting a push protection bypass. + Push_protection_bypass_request_html_url string `json:"push_protection_bypass_request_html_url,omitempty"` // The URL to a push protection bypass request. + Push_protection_bypassed_at string `json:"push_protection_bypassed_at,omitempty"` // The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Html_url string `json:"html_url,omitempty"` // The GitHub URL of the alert resource. + Multi_repo bool `json:"multi_repo,omitempty"` // Whether the detected secret was found in multiple repositories in the same organization or enterprise. + Is_base64_encoded bool `json:"is_base64_encoded,omitempty"` // A boolean value representing whether or not alert is base64 encoded + Push_protection_bypass_request_reviewer GeneratedType_Nullable_simple_user `json:"push_protection_bypass_request_reviewer,omitempty"` // A GitHub user. + Secret_type string `json:"secret_type,omitempty"` // The type of secret that secret scanning detected. + Validity string `json:"validity,omitempty"` // The token status as of the latest validity check. + Push_protection_bypassed_by GeneratedType_Nullable_simple_user `json:"push_protection_bypassed_by,omitempty"` // A GitHub user. + Resolution_comment string `json:"resolution_comment,omitempty"` // The comment that was optionally added when this alert was closed + Has_more_locations bool `json:"has_more_locations,omitempty"` // A boolean value representing whether or not the token in the alert was detected in more than one location. + Secret string `json:"secret,omitempty"` // The secret that was detected. + Created_at string `json:"created_at,omitempty"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Locations_url string `json:"locations_url,omitempty"` // The REST API URL of the code locations for this alert. + Push_protection_bypassed bool `json:"push_protection_bypassed,omitempty"` // Whether push protection was bypassed for the detected secret. + Resolution string `json:"resolution,omitempty"` // **Required when the `state` is `resolved`.** The reason for resolving the alert. + First_location_detected interface{} `json:"first_location_detected,omitempty"` // Details on the location where the token was initially detected. This can be a commit, wiki commit, issue, discussion, pull request. } -// Authorization represents the Authorization schema from the OpenAPI specification -type Authorization struct { - Url string `json:"url"` - Id int64 `json:"id"` - Scopes []string `json:"scopes"` // A list of scopes that this authorization is in. - Created_at string `json:"created_at"` - Note_url string `json:"note_url"` - Expires_at string `json:"expires_at"` - App map[string]interface{} `json:"app"` - Token string `json:"token"` - Hashed_token string `json:"hashed_token"` - Installation GeneratedType `json:"installation,omitempty"` - Fingerprint string `json:"fingerprint"` - Token_last_eight string `json:"token_last_eight"` - Updated_at string `json:"updated_at"` - Note string `json:"note"` - User GeneratedType `json:"user,omitempty"` // A GitHub user. +// GeneratedType_Webhook_project_card_converted represents the GeneratedType_Webhook_project_card_converted schema from the OpenAPI specification +type GeneratedType_Webhook_project_card_converted struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Project_card Webhooksprojectcard `json:"project_card"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue_title_url string `json:"issue_title_url"` // The API URL to get the issue where the secret was detected. +// GeneratedType_Secret_scanning_push_protection_bypass represents the GeneratedType_Secret_scanning_push_protection_bypass schema from the OpenAPI specification +type GeneratedType_Secret_scanning_push_protection_bypass struct { + Expire_at string `json:"expire_at,omitempty"` // The time that the bypass will expire in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Reason string `json:"reason,omitempty"` // The reason for bypassing push protection. + Token_type string `json:"token_type,omitempty"` // The token type this bypass is for. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_org_block_unblocked represents the GeneratedType_Webhook_org_block_unblocked schema from the OpenAPI specification +type GeneratedType_Webhook_org_block_unblocked struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Blocked_user Webhooksuser `json:"blocked_user"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Date string `json:"date,omitempty"` - Email string `json:"email,omitempty"` - Name string `json:"name,omitempty"` +// GeneratedType_Secret_scanning_location_discussion_body represents the GeneratedType_Secret_scanning_location_discussion_body schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_discussion_body struct { + Discussion_body_url string `json:"discussion_body_url"` // The URL to the discussion where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_team_deleted represents the GeneratedType_Webhook_team_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_team_deleted struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository map[string]interface{} `json:"repository,omitempty"` // A git repository + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Personal_access_token_request GeneratedType `json:"personal_access_token_request"` // Details of a Personal Access Token Request. - Sender GeneratedType `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enforce_admins map[string]interface{} `json:"enforce_admins,omitempty"` - Required_conversation_resolution map[string]interface{} `json:"required_conversation_resolution,omitempty"` - Required_status_checks GeneratedType `json:"required_status_checks,omitempty"` // Status Check Policy - Allow_deletions map[string]interface{} `json:"allow_deletions,omitempty"` - Allow_fork_syncing map[string]interface{} `json:"allow_fork_syncing,omitempty"` // Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow fork syncing. Set to `false` to prevent fork syncing. - Lock_branch map[string]interface{} `json:"lock_branch,omitempty"` // Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. - Required_pull_request_reviews map[string]interface{} `json:"required_pull_request_reviews,omitempty"` - Required_signatures map[string]interface{} `json:"required_signatures,omitempty"` - Allow_force_pushes map[string]interface{} `json:"allow_force_pushes,omitempty"` - Required_linear_history map[string]interface{} `json:"required_linear_history,omitempty"` - Block_creations map[string]interface{} `json:"block_creations,omitempty"` - Restrictions GeneratedType `json:"restrictions,omitempty"` // Branch Restriction Policy +// GeneratedType_Marketplace_account represents the GeneratedType_Marketplace_account schema from the OpenAPI specification +type GeneratedType_Marketplace_account struct { + Id int `json:"id"` + Login string `json:"login"` + Node_id string `json:"node_id,omitempty"` + Organization_billing_email string `json:"organization_billing_email,omitempty"` + TypeField string `json:"type"` Url string `json:"url"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Environment map[string]interface{} `json:"environment"` - Reviewers []map[string]interface{} `json:"reviewers"` // The people or teams that may approve jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed. - Wait_timer int `json:"wait_timer"` // The set duration of the wait timer - Wait_timer_started_at string `json:"wait_timer_started_at"` // The time that the wait timer began. - Current_user_can_approve bool `json:"current_user_can_approve"` // Whether the currently authenticated user can approve the deployment -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Default_repository_permission string `json:"default_repository_permission,omitempty"` - Has_repository_projects bool `json:"has_repository_projects"` - Dependabot_alerts_enabled_for_new_repositories bool `json:"dependabot_alerts_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether Dependabot alerts are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. - Issues_url string `json:"issues_url"` - Secret_scanning_push_protection_custom_link_enabled bool `json:"secret_scanning_push_protection_custom_link_enabled,omitempty"` // Whether a custom link is shown to contributors who are blocked from pushing a secret by push protection. - Default_repository_branch string `json:"default_repository_branch,omitempty"` // The default branch for repositories created in this organization. - Public_repos int `json:"public_repos"` Email string `json:"email,omitempty"` - Html_url string `json:"html_url"` - Two_factor_requirement_enabled bool `json:"two_factor_requirement_enabled,omitempty"` - Private_gists int `json:"private_gists,omitempty"` - Collaborators int `json:"collaborators,omitempty"` // The number of collaborators on private repositories. This field may be null if the number of private repositories is over 50,000. - Members_can_create_internal_repositories bool `json:"members_can_create_internal_repositories,omitempty"` - Advanced_security_enabled_for_new_repositories bool `json:"advanced_security_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether GitHub Advanced Security is enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. - Deploy_keys_enabled_for_repositories bool `json:"deploy_keys_enabled_for_repositories,omitempty"` // Controls whether or not deploy keys may be added and used for repositories in the organization. - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` - Disk_usage int `json:"disk_usage,omitempty"` - Display_commenter_full_name_setting_enabled bool `json:"display_commenter_full_name_setting_enabled,omitempty"` - Following int `json:"following"` - Members_url string `json:"members_url"` - Url string `json:"url"` - Followers int `json:"followers"` - Hooks_url string `json:"hooks_url"` - Is_verified bool `json:"is_verified,omitempty"` - Dependency_graph_enabled_for_new_repositories bool `json:"dependency_graph_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether dependency graph is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. - Node_id string `json:"node_id"` - Avatar_url string `json:"avatar_url"` - Owned_private_repos int `json:"owned_private_repos,omitempty"` - Events_url string `json:"events_url"` - Plan map[string]interface{} `json:"plan,omitempty"` - Location string `json:"location,omitempty"` - Repos_url string `json:"repos_url"` - TypeField string `json:"type"` - Archived_at string `json:"archived_at"` - Members_can_create_private_pages bool `json:"members_can_create_private_pages,omitempty"` - Members_can_delete_issues bool `json:"members_can_delete_issues,omitempty"` - Description string `json:"description"` - Members_can_create_private_repositories bool `json:"members_can_create_private_repositories,omitempty"` - Secret_scanning_push_protection_enabled_for_new_repositories bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether secret scanning push protection is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. - Members_can_fork_private_repositories bool `json:"members_can_fork_private_repositories,omitempty"` - Members_can_create_public_pages bool `json:"members_can_create_public_pages,omitempty"` - Total_private_repos int `json:"total_private_repos,omitempty"` - Created_at string `json:"created_at"` - Members_can_invite_outside_collaborators bool `json:"members_can_invite_outside_collaborators,omitempty"` - Members_can_delete_repositories bool `json:"members_can_delete_repositories,omitempty"` - Secret_scanning_enabled_for_new_repositories bool `json:"secret_scanning_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether secret scanning is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. - Dependabot_security_updates_enabled_for_new_repositories bool `json:"dependabot_security_updates_enabled_for_new_repositories,omitempty"` // **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. Whether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. - Billing_email string `json:"billing_email,omitempty"` - Company string `json:"company,omitempty"` - Public_gists int `json:"public_gists"` - Login string `json:"login"` - Members_can_view_dependency_insights bool `json:"members_can_view_dependency_insights,omitempty"` - Members_allowed_repository_creation_type string `json:"members_allowed_repository_creation_type,omitempty"` - Updated_at string `json:"updated_at"` - Readers_can_create_discussions bool `json:"readers_can_create_discussions,omitempty"` - Twitter_username string `json:"twitter_username,omitempty"` - Public_members_url string `json:"public_members_url"` - Name string `json:"name,omitempty"` - Has_organization_projects bool `json:"has_organization_projects"` - Members_can_create_teams bool `json:"members_can_create_teams,omitempty"` - Id int `json:"id"` - Members_can_create_repositories bool `json:"members_can_create_repositories,omitempty"` - Members_can_change_repo_visibility bool `json:"members_can_change_repo_visibility,omitempty"` - Secret_scanning_push_protection_custom_link string `json:"secret_scanning_push_protection_custom_link,omitempty"` // An optional URL string to display to contributors who are blocked from pushing a secret. - Blog string `json:"blog,omitempty"` - Members_can_create_pages bool `json:"members_can_create_pages,omitempty"` - Members_can_create_public_repositories bool `json:"members_can_create_public_repositories,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Description string `json:"description,omitempty"` - Metadata map[string]interface{} `json:"metadata,omitempty"` - Homepage string `json:"homepage,omitempty"` - Dependencies []map[string]interface{} `json:"dependencies,omitempty"` - Platform string `json:"platform,omitempty"` - Readme string `json:"readme,omitempty"` - Name string `json:"name,omitempty"` - Repo string `json:"repo,omitempty"` - Version_info map[string]interface{} `json:"version_info,omitempty"` - Commit_oid string `json:"commit_oid,omitempty"` +// GeneratedType_Protected_branch represents the GeneratedType_Protected_branch schema from the OpenAPI specification +type GeneratedType_Protected_branch struct { + Required_pull_request_reviews map[string]interface{} `json:"required_pull_request_reviews,omitempty"` + Required_signatures map[string]interface{} `json:"required_signatures,omitempty"` + Restrictions GeneratedType_Branch_restriction_policy `json:"restrictions,omitempty"` // Branch Restriction Policy + Allow_deletions map[string]interface{} `json:"allow_deletions,omitempty"` + Enforce_admins map[string]interface{} `json:"enforce_admins,omitempty"` + Required_linear_history map[string]interface{} `json:"required_linear_history,omitempty"` + Required_status_checks GeneratedType_Status_check_policy `json:"required_status_checks,omitempty"` // Status Check Policy + Url string `json:"url"` + Allow_force_pushes map[string]interface{} `json:"allow_force_pushes,omitempty"` + Allow_fork_syncing map[string]interface{} `json:"allow_fork_syncing,omitempty"` // Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow fork syncing. Set to `false` to prevent fork syncing. + Block_creations map[string]interface{} `json:"block_creations,omitempty"` + Required_conversation_resolution map[string]interface{} `json:"required_conversation_resolution,omitempty"` + Lock_branch map[string]interface{} `json:"lock_branch,omitempty"` // Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // Full Repository - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Deployment_branch_policy_name_pattern_with_type represents the GeneratedType_Deployment_branch_policy_name_pattern_with_type schema from the OpenAPI specification +type GeneratedType_Deployment_branch_policy_name_pattern_with_type struct { + TypeField string `json:"type,omitempty"` // Whether this rule targets a branch or tag + Name string `json:"name"` // The name pattern that branches or tags must match in order to deploy to the environment. Wildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`. For more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch). } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. - Archive_url string `json:"archive_url"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub user. - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. - Svn_url string `json:"svn_url"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits - Mirror_url string `json:"mirror_url"` - Collaborators_url string `json:"collaborators_url"` - Subscribers_count int `json:"subscribers_count,omitempty"` - Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. - Pushed_at string `json:"pushed_at"` - Clone_url string `json:"clone_url"` - Ssh_url string `json:"ssh_url"` - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged - Languages_url string `json:"languages_url"` - Milestones_url string `json:"milestones_url"` - Private bool `json:"private"` // Whether the repository is private or public. - Homepage string `json:"homepage"` - Archived bool `json:"archived"` // Whether the repository is archived. - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. - License GeneratedType `json:"license"` // License Simple - Teams_url string `json:"teams_url"` - Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository - Tags_url string `json:"tags_url"` - Events_url string `json:"events_url"` - Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Watchers int `json:"watchers"` - Deployments_url string `json:"deployments_url"` - Keys_url string `json:"keys_url"` - Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. - Git_refs_url string `json:"git_refs_url"` - Language string `json:"language"` +// GeneratedType_Security_and_analysis represents the GeneratedType_Security_and_analysis schema from the OpenAPI specification +type GeneratedType_Security_and_analysis struct { + Dependabot_security_updates map[string]interface{} `json:"dependabot_security_updates,omitempty"` // Enable or disable Dependabot security updates for the repository. + Secret_scanning map[string]interface{} `json:"secret_scanning,omitempty"` + Secret_scanning_ai_detection map[string]interface{} `json:"secret_scanning_ai_detection,omitempty"` + Secret_scanning_non_provider_patterns map[string]interface{} `json:"secret_scanning_non_provider_patterns,omitempty"` + Secret_scanning_push_protection map[string]interface{} `json:"secret_scanning_push_protection,omitempty"` + Advanced_security map[string]interface{} `json:"advanced_security,omitempty"` + Code_security map[string]interface{} `json:"code_security,omitempty"` +} + +// Milestone represents the Milestone schema from the OpenAPI specification +type Milestone struct { + Closed_issues int `json:"closed_issues"` + State string `json:"state"` // The state of the milestone. + Created_at string `json:"created_at"` + Id int `json:"id"` Description string `json:"description"` - Has_projects bool `json:"has_projects"` // Whether projects are enabled. - Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. - Template_repository map[string]interface{} `json:"template_repository,omitempty"` - Topics []string `json:"topics,omitempty"` - Subscribers_url string `json:"subscribers_url"` - Forks_count int `json:"forks_count"` - Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. - Issues_url string `json:"issues_url"` - Notifications_url string `json:"notifications_url"` - Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). - Releases_url string `json:"releases_url"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Has_issues bool `json:"has_issues"` // Whether issues are enabled. - Statuses_url string `json:"statuses_url"` - Pulls_url string `json:"pulls_url"` - Git_commits_url string `json:"git_commits_url"` - Name string `json:"name"` // The name of the repository. + Title string `json:"title"` // The title of the milestone. Url string `json:"url"` - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. - Branches_url string `json:"branches_url"` - Git_tags_url string `json:"git_tags_url"` - Merges_url string `json:"merges_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. + Due_on string `json:"due_on"` + Open_issues int `json:"open_issues"` Updated_at string `json:"updated_at"` + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. Html_url string `json:"html_url"` - Full_name string `json:"full_name"` - Master_branch string `json:"master_branch,omitempty"` - Stargazers_url string `json:"stargazers_url"` - Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. - Comments_url string `json:"comments_url"` - Forks_url string `json:"forks_url"` - Forks int `json:"forks"` - Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo - Starred_at string `json:"starred_at,omitempty"` - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. - Assignees_url string `json:"assignees_url"` - Commits_url string `json:"commits_url"` - Contents_url string `json:"contents_url"` - Has_pages bool `json:"has_pages"` - Hooks_url string `json:"hooks_url"` - Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). - Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. - Issue_events_url string `json:"issue_events_url"` - Open_issues int `json:"open_issues"` - Trees_url string `json:"trees_url"` - Stargazers_count int `json:"stargazers_count"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Downloads_url string `json:"downloads_url"` - Open_issues_count int `json:"open_issues_count"` - Created_at string `json:"created_at"` - Compare_url string `json:"compare_url"` - Contributors_url string `json:"contributors_url"` - Network_count int `json:"network_count,omitempty"` - Node_id string `json:"node_id"` - Watchers_count int `json:"watchers_count"` Labels_url string `json:"labels_url"` - Default_branch string `json:"default_branch"` // The default branch of the repository. - Blobs_url string `json:"blobs_url"` - Id int64 `json:"id"` // Unique identifier of the repository - Owner GeneratedType `json:"owner"` // A GitHub user. - Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. - Fork bool `json:"fork"` - Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. - Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. - Git_url string `json:"git_url"` - Issue_comment_url string `json:"issue_comment_url"` - Subscription_url string `json:"subscription_url"` + Node_id string `json:"node_id"` + Number int `json:"number"` // The number of the milestone. + Closed_at string `json:"closed_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Protected bool `json:"protected"` - Protection GeneratedType `json:"protection"` // Branch Protection - Protection_url string `json:"protection_url"` - Required_approving_review_count int `json:"required_approving_review_count,omitempty"` - Links map[string]interface{} `json:"_links"` - Commit Commit `json:"commit"` // Commit +// GeneratedType_Simple_classroom_organization represents the GeneratedType_Simple_classroom_organization schema from the OpenAPI specification +type GeneratedType_Simple_classroom_organization struct { + Node_id string `json:"node_id"` + Avatar_url string `json:"avatar_url"` + Html_url string `json:"html_url"` + Id int `json:"id"` + Login string `json:"login"` Name string `json:"name"` - Pattern string `json:"pattern,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Project Webhooksproject `json:"project"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_sponsorship_cancelled represents the GeneratedType_Webhook_sponsorship_cancelled schema from the OpenAPI specification +type GeneratedType_Webhook_sponsorship_cancelled struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Sponsorship Webhookssponsorship `json:"sponsorship"` Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Include_claim_keys []string `json:"include_claim_keys"` // Array of unique strings. Each claim key can only contain alphanumeric characters and underscores. +// GeneratedType_Gist_commit represents the GeneratedType_Gist_commit schema from the OpenAPI specification +type GeneratedType_Gist_commit struct { + Change_status map[string]interface{} `json:"change_status"` + Committed_at string `json:"committed_at"` + Url string `json:"url"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Version string `json:"version"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Project_id int `json:"project_id"` - Project_url string `json:"project_url"` - Url string `json:"url"` - Column_name string `json:"column_name"` - Id int `json:"id"` - Previous_column_name string `json:"previous_column_name,omitempty"` +// GeneratedType_Copilot_usage_metrics_day represents the GeneratedType_Copilot_usage_metrics_day schema from the OpenAPI specification +type GeneratedType_Copilot_usage_metrics_day struct { + Total_engaged_users int `json:"total_engaged_users,omitempty"` // The total number of Copilot users who engaged with any Copilot feature, for the given day. Examples include but are not limited to accepting a code suggestion, prompting Copilot chat, or triggering a PR Summary. Does not include authentication events. Is not limited to the individual features detailed on the endpoint. + Copilot_dotcom_chat GeneratedType_Copilot_dotcom_chat `json:"copilot_dotcom_chat,omitempty"` // Usage metrics for Copilot Chat in GitHub.com + Copilot_dotcom_pull_requests GeneratedType_Copilot_dotcom_pull_requests `json:"copilot_dotcom_pull_requests,omitempty"` // Usage metrics for Copilot for pull requests. + Copilot_ide_chat GeneratedType_Copilot_ide_chat `json:"copilot_ide_chat,omitempty"` // Usage metrics for Copilot Chat in the IDE. + Copilot_ide_code_completions GeneratedType_Copilot_ide_code_completions `json:"copilot_ide_code_completions,omitempty"` // Usage metrics for Copilot editor code completions in the IDE. + Date string `json:"date"` // The date for which the usage metrics are aggregated, in `YYYY-MM-DD` format. + Total_active_users int `json:"total_active_users,omitempty"` // The total number of Copilot users with activity belonging to any Copilot feature, globally, for the given day. Includes passive activity such as receiving a code suggestion, as well as engagement activity such as accepting a code suggestion or prompting chat. Does not include authentication events. Is not limited to the individual features detailed on the endpoint. } -// Milestone represents the Milestone schema from the OpenAPI specification -type Milestone struct { +// GeneratedType_Repository_advisory_vulnerability represents the GeneratedType_Repository_advisory_vulnerability schema from the OpenAPI specification +type GeneratedType_Repository_advisory_vulnerability struct { + PackageField map[string]interface{} `json:"package"` // The name of the package affected by the vulnerability. + Patched_versions string `json:"patched_versions"` // The package version(s) that resolve the vulnerability. + Vulnerable_functions []string `json:"vulnerable_functions"` // The functions in the package that are affected. + Vulnerable_version_range string `json:"vulnerable_version_range"` // The range of the package versions affected by the vulnerability. +} + +// GeneratedType_Repository_ruleset represents the GeneratedType_Repository_ruleset schema from the OpenAPI specification +type GeneratedType_Repository_ruleset struct { + Rules []GeneratedType_Repository_rule `json:"rules,omitempty"` + Source_type string `json:"source_type,omitempty"` // The type of the source of the ruleset + Target string `json:"target,omitempty"` // The target of the ruleset + Links map[string]interface{} `json:"_links,omitempty"` + Current_user_can_bypass string `json:"current_user_can_bypass,omitempty"` // The bypass type of the user making the API request for this ruleset. This field is only returned when querying the repository-level endpoint. + Enforcement string `json:"enforcement"` // The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise). + Id int `json:"id"` // The ID of the ruleset + Source string `json:"source"` // The name of the source + Updated_at string `json:"updated_at,omitempty"` + Bypass_actors []GeneratedType_Repository_ruleset_bypass_actor `json:"bypass_actors,omitempty"` // The actors that can bypass the rules in this ruleset + Conditions interface{} `json:"conditions,omitempty"` + Name string `json:"name"` // The name of the ruleset + Node_id string `json:"node_id,omitempty"` + Created_at string `json:"created_at,omitempty"` +} + +// GeneratedType_Webhook_package_published represents the GeneratedType_Webhook_package_published schema from the OpenAPI specification +type GeneratedType_Webhook_package_published struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + PackageField map[string]interface{} `json:"package"` // Information about the package. +} + +// GeneratedType_Webhook_issues_locked represents the GeneratedType_Webhook_issues_locked schema from the OpenAPI specification +type GeneratedType_Webhook_issues_locked struct { + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +} + +// GeneratedType_Actions_hosted_runner_limits represents the GeneratedType_Actions_hosted_runner_limits schema from the OpenAPI specification +type GeneratedType_Actions_hosted_runner_limits struct { + Public_ips map[string]interface{} `json:"public_ips"` // Provides details of static public IP limits for GitHub-hosted Hosted Runners +} + +// GeneratedType_Actions_cache_list represents the GeneratedType_Actions_cache_list schema from the OpenAPI specification +type GeneratedType_Actions_cache_list struct { + Total_count int `json:"total_count"` // Total number of caches + Actions_caches []map[string]interface{} `json:"actions_caches"` // Array of caches +} + +// GeneratedType_Deployment_simple represents the GeneratedType_Deployment_simple schema from the OpenAPI specification +type GeneratedType_Deployment_simple struct { + Original_environment string `json:"original_environment,omitempty"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Repository_url string `json:"repository_url"` + Url string `json:"url"` Node_id string `json:"node_id"` + Statuses_url string `json:"statuses_url"` + Task string `json:"task"` // Parameter to specify a task to execute + Transient_environment bool `json:"transient_environment,omitempty"` // Specifies if the given environment is will no longer exist at some point in the future. Default: false. + Id int `json:"id"` // Unique identifier of the deployment + Production_environment bool `json:"production_environment,omitempty"` // Specifies if the given environment is one that end-users directly interact with. Default: false. + Description string `json:"description"` + Environment string `json:"environment"` // Name for the target deployment environment. + Updated_at string `json:"updated_at"` Created_at string `json:"created_at"` +} + +// GeneratedType_Org_hook represents the GeneratedType_Org_hook schema from the OpenAPI specification +type GeneratedType_Org_hook struct { + TypeField string `json:"type"` + Config map[string]interface{} `json:"config"` + Deliveries_url string `json:"deliveries_url,omitempty"` Updated_at string `json:"updated_at"` + Url string `json:"url"` + Active bool `json:"active"` + Events []string `json:"events"` + Name string `json:"name"` + Ping_url string `json:"ping_url"` + Created_at string `json:"created_at"` Id int `json:"id"` - Closed_at string `json:"closed_at"` - Labels_url string `json:"labels_url"` - Open_issues int `json:"open_issues"` +} + +// GeneratedType_Webhook_pull_request_locked represents the GeneratedType_Webhook_pull_request_locked schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_locked struct { + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +} + +// GeneratedType_Webhook_deployment_review_approved represents the GeneratedType_Webhook_deployment_review_approved schema from the OpenAPI specification +type GeneratedType_Webhook_deployment_review_approved struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Since string `json:"since"` + Workflow_job_run Webhooksworkflowjobrun `json:"workflow_job_run,omitempty"` + Reviewers []map[string]interface{} `json:"reviewers,omitempty"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Approver Webhooksapprover `json:"approver,omitempty"` + Comment string `json:"comment,omitempty"` + Workflow_job_runs []map[string]interface{} `json:"workflow_job_runs,omitempty"` + Workflow_run map[string]interface{} `json:"workflow_run"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +} + +// Issue represents the Issue schema from the OpenAPI specification +type Issue struct { + Events_url string `json:"events_url"` + Created_at string `json:"created_at"` + Repository_url string `json:"repository_url"` + Url string `json:"url"` // URL for the issue + Locked bool `json:"locked"` + Updated_at string `json:"updated_at"` + Assignees []GeneratedType_Simple_user `json:"assignees,omitempty"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Title string `json:"title"` // Title of the issue + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Body_html string `json:"body_html,omitempty"` + Draft bool `json:"draft,omitempty"` Html_url string `json:"html_url"` - Url string `json:"url"` - Due_on string `json:"due_on"` - Closed_issues int `json:"closed_issues"` - Description string `json:"description"` - State string `json:"state"` // The state of the milestone. - Title string `json:"title"` // The title of the milestone. - Creator GeneratedType `json:"creator"` // A GitHub user. - Number int `json:"number"` // The number of the milestone. + TypeField GeneratedType_Issue_type `json:"type,omitempty"` // The type of issue. + Body_text string `json:"body_text,omitempty"` + Closed_at string `json:"closed_at"` + Pull_request map[string]interface{} `json:"pull_request,omitempty"` + Id int64 `json:"id"` + Comments int `json:"comments"` + Timeline_url string `json:"timeline_url,omitempty"` + Comments_url string `json:"comments_url"` + State string `json:"state"` // State of the issue; either 'open' or 'closed' + Author_association string `json:"author_association"` // How the author is associated with the repository. + Number int `json:"number"` // Number uniquely identifying the issue within its repository + Body string `json:"body,omitempty"` // Contents of the issue + Repository Repository `json:"repository,omitempty"` // A repository on GitHub. + Active_lock_reason string `json:"active_lock_reason,omitempty"` + Closed_by GeneratedType_Nullable_simple_user `json:"closed_by,omitempty"` // A GitHub user. + Labels []interface{} `json:"labels"` // Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository + State_reason string `json:"state_reason,omitempty"` // The reason for the current state + Node_id string `json:"node_id"` + Labels_url string `json:"labels_url"` + Milestone GeneratedType_Nullable_milestone `json:"milestone"` // A collection of related issues and pull requests. + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Sub_issues_summary GeneratedType_Sub_issues_summary `json:"sub_issues_summary,omitempty"` + Assignee GeneratedType_Nullable_simple_user `json:"assignee"` // A GitHub user. } -// Installation represents the Installation schema from the OpenAPI specification -type Installation struct { - App_id int `json:"app_id"` - Created_at string `json:"created_at"` - Events []string `json:"events"` - Single_file_name string `json:"single_file_name"` - Id int `json:"id"` // The ID of the installation. - Suspended_by GeneratedType `json:"suspended_by"` // A GitHub user. - Account interface{} `json:"account"` - App_slug string `json:"app_slug"` - Html_url string `json:"html_url"` - Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved - Suspended_at string `json:"suspended_at"` - Access_tokens_url string `json:"access_tokens_url"` - Has_multiple_single_files bool `json:"has_multiple_single_files,omitempty"` - Target_id int `json:"target_id"` // The ID of the user or organization this token is being scoped to. - Repositories_url string `json:"repositories_url"` - Permissions GeneratedType `json:"permissions"` // The permissions granted to the user access token. - Single_file_paths []string `json:"single_file_paths,omitempty"` - Updated_at string `json:"updated_at"` - Contact_email string `json:"contact_email,omitempty"` - Target_type string `json:"target_type"` +// GeneratedType_Webhook_pull_request_enqueued represents the GeneratedType_Webhook_pull_request_enqueued schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_enqueued struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Digest string `json:"digest"` - Download_count int `json:"download_count"` - Id int `json:"id"` - Node_id string `json:"node_id"` - Size int `json:"size"` - Uploader GeneratedType `json:"uploader"` // A GitHub user. - Content_type string `json:"content_type"` - Name string `json:"name"` // The file name of the asset. +// GeneratedType_Repository_ruleset_conditions represents the GeneratedType_Repository_ruleset_conditions schema from the OpenAPI specification +type GeneratedType_Repository_ruleset_conditions struct { + Ref_name map[string]interface{} `json:"ref_name,omitempty"` +} + +// Thread represents the Thread schema from the OpenAPI specification +type Thread struct { Updated_at string `json:"updated_at"` + Subject map[string]interface{} `json:"subject"` + Subscription_url string `json:"subscription_url"` + Id string `json:"id"` Url string `json:"url"` - Created_at string `json:"created_at"` - Label string `json:"label"` - Browser_download_url string `json:"browser_download_url"` - State string `json:"state"` // State of the release asset. + Last_read_at string `json:"last_read_at"` + Reason string `json:"reason"` + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + Unread bool `json:"unread"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` - Event string `json:"event"` - Source map[string]interface{} `json:"source"` - Updated_at string `json:"updated_at"` - Actor GeneratedType `json:"actor,omitempty"` // A GitHub user. +// GeneratedType_Webhook_custom_property_updated represents the GeneratedType_Webhook_custom_property_updated schema from the OpenAPI specification +type GeneratedType_Webhook_custom_property_updated struct { + Definition GeneratedType_Custom_property `json:"definition"` // Custom property defined on an organization + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Unlabeled_issue_event represents the GeneratedType_Unlabeled_issue_event schema from the OpenAPI specification +type GeneratedType_Unlabeled_issue_event struct { + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Url string `json:"url"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_url string `json:"commit_url"` + Node_id string `json:"node_id"` + Commit_id string `json:"commit_id"` + Created_at string `json:"created_at"` + Event string `json:"event"` + Id int `json:"id"` + Label map[string]interface{} `json:"label"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) the comment belongs to. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_projects_v2_status_update_deleted represents the GeneratedType_Webhook_projects_v2_status_update_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_status_update_deleted struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_status_update GeneratedType_Projects_v2_status_update `json:"projects_v2_status_update"` // An status update belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Comment Webhooksissuecomment `json:"comment"` // The [comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment) itself. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Secret_scanning_scan represents the GeneratedType_Secret_scanning_scan schema from the OpenAPI specification +type GeneratedType_Secret_scanning_scan struct { + Status string `json:"status,omitempty"` // The state of the scan. Either "completed", "running", or "pending" + TypeField string `json:"type,omitempty"` // The type of scan + Completed_at string `json:"completed_at,omitempty"` // The time that the scan was completed. Empty if the scan is running + Started_at string `json:"started_at,omitempty"` // The time that the scan was started. Empty if the scan is pending } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - First_patched_version map[string]interface{} `json:"first_patched_version"` // Details pertaining to the package version that patches this vulnerability. - PackageField GeneratedType `json:"package"` // Details for the vulnerable package. - Severity string `json:"severity"` // The severity of the vulnerability. - Vulnerable_version_range string `json:"vulnerable_version_range"` // Conditions that identify vulnerable versions of this vulnerability's package. +// GeneratedType_Webhook_pull_request_unlocked represents the GeneratedType_Webhook_pull_request_unlocked schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_unlocked struct { + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` // The pull request number. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Protected bool `json:"protected"` - Protection GeneratedType `json:"protection,omitempty"` // Branch Protection - Protection_url string `json:"protection_url,omitempty"` - Commit map[string]interface{} `json:"commit"` - Name string `json:"name"` +// GeneratedType_Nullable_issue represents the GeneratedType_Nullable_issue schema from the OpenAPI specification +type GeneratedType_Nullable_issue struct { + Url string `json:"url"` // URL for the issue + Events_url string `json:"events_url"` + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Repository Repository `json:"repository,omitempty"` // A repository on GitHub. + TypeField GeneratedType_Issue_type `json:"type,omitempty"` // The type of issue. + Assignees []GeneratedType_Simple_user `json:"assignees,omitempty"` + Body_html string `json:"body_html,omitempty"` + Html_url string `json:"html_url"` + Id int64 `json:"id"` + Body string `json:"body,omitempty"` // Contents of the issue + Sub_issues_summary GeneratedType_Sub_issues_summary `json:"sub_issues_summary,omitempty"` + Draft bool `json:"draft,omitempty"` + State string `json:"state"` // State of the issue; either 'open' or 'closed' + Timeline_url string `json:"timeline_url,omitempty"` + Labels_url string `json:"labels_url"` + Locked bool `json:"locked"` + Title string `json:"title"` // Title of the issue + Repository_url string `json:"repository_url"` + Created_at string `json:"created_at"` + Body_text string `json:"body_text,omitempty"` + Comments int `json:"comments"` + Pull_request map[string]interface{} `json:"pull_request,omitempty"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + Assignee GeneratedType_Nullable_simple_user `json:"assignee"` // A GitHub user. + Active_lock_reason string `json:"active_lock_reason,omitempty"` + Number int `json:"number"` // Number uniquely identifying the issue within its repository + Closed_at string `json:"closed_at"` + Milestone GeneratedType_Nullable_milestone `json:"milestone"` // A collection of related issues and pull requests. + Labels []interface{} `json:"labels"` // Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository + Comments_url string `json:"comments_url"` + Node_id string `json:"node_id"` + State_reason string `json:"state_reason,omitempty"` // The reason for the current state + Closed_by GeneratedType_Nullable_simple_user `json:"closed_by,omitempty"` // A GitHub user. + Updated_at string `json:"updated_at"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Resources map[string]interface{} `json:"resources"` - Rate GeneratedType `json:"rate"` +// GeneratedType_Commit_activity represents the GeneratedType_Commit_activity schema from the OpenAPI specification +type GeneratedType_Commit_activity struct { + Total int `json:"total"` + Week int `json:"week"` + Days []int `json:"days"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the secret - Selected_repositories_url string `json:"selected_repositories_url"` // The API URL at which the list of repositories this secret is visible to can be retrieved - Updated_at string `json:"updated_at"` // The date and time at which the secret was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Visibility string `json:"visibility"` // The type of repositories in the organization that the secret is visible to - Created_at string `json:"created_at"` // The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. +// GeneratedType_Clone_traffic represents the GeneratedType_Clone_traffic schema from the OpenAPI specification +type GeneratedType_Clone_traffic struct { + Uniques int `json:"uniques"` + Clones []Traffic `json:"clones"` + Count int `json:"count"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url,omitempty"` - Sha string `json:"sha"` - Tree []map[string]interface{} `json:"tree"` // Objects specifying a tree structure - Truncated bool `json:"truncated"` +// GeneratedType_Review_requested_issue_event represents the GeneratedType_Review_requested_issue_event schema from the OpenAPI specification +type GeneratedType_Review_requested_issue_event struct { + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Id int `json:"id"` + Requested_reviewer GeneratedType_Simple_user `json:"requested_reviewer,omitempty"` // A GitHub user. + Requested_team Team `json:"requested_team,omitempty"` // Groups of organization members that gives permissions on specified repositories. + Event string `json:"event"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Review_requester GeneratedType_Simple_user `json:"review_requester"` // A GitHub user. + Commit_id string `json:"commit_id"` + Created_at string `json:"created_at"` + Url string `json:"url"` + Commit_url string `json:"commit_url"` + Node_id string `json:"node_id"` } -// Autolink represents the Autolink schema from the OpenAPI specification -type Autolink struct { - Key_prefix string `json:"key_prefix"` // The prefix of a key that is linkified. - Url_template string `json:"url_template"` // A template for the target URL that is generated if a key was found. - Id int `json:"id"` - Is_alphanumeric bool `json:"is_alphanumeric"` // Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. +// GeneratedType_Git_commit represents the GeneratedType_Git_commit schema from the OpenAPI specification +type GeneratedType_Git_commit struct { + Author map[string]interface{} `json:"author"` // Identifying information for the git-user + Parents []map[string]interface{} `json:"parents"` + Tree map[string]interface{} `json:"tree"` + Message string `json:"message"` // Message describing the purpose of the commit + Sha string `json:"sha"` // SHA for the commit + Url string `json:"url"` + Committer map[string]interface{} `json:"committer"` // Identifying information for the git-user + Html_url string `json:"html_url"` + Node_id string `json:"node_id"` + Verification map[string]interface{} `json:"verification"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repo Repository `json:"repo"` // A repository on GitHub. - Starred_at string `json:"starred_at"` +// GeneratedType_Webhook_installation_deleted represents the GeneratedType_Webhook_installation_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_installation_deleted struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requester interface{} `json:"requester,omitempty"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation Installation `json:"installation"` // Installation } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at,omitempty"` // The time the issue type created. - Description string `json:"description"` // The description of the issue type. - Id int `json:"id"` // The unique identifier of the issue type. - Is_enabled bool `json:"is_enabled,omitempty"` // The enabled state of the issue type. - Name string `json:"name"` // The name of the issue type. - Node_id string `json:"node_id"` // The node identifier of the issue type. - Updated_at string `json:"updated_at,omitempty"` // The time the issue type last updated. - Color string `json:"color,omitempty"` // The color of the issue type. +// GeneratedType_Organization_role represents the GeneratedType_Organization_role schema from the OpenAPI specification +type GeneratedType_Organization_role struct { + Created_at string `json:"created_at"` // The date and time the role was created. + Base_role string `json:"base_role,omitempty"` // The system role from which this role inherits permissions. + Description string `json:"description,omitempty"` // A short description about who this role is for or what permissions it grants. + Name string `json:"name"` // The name of the role. + Permissions []string `json:"permissions"` // A list of permissions included in this role. + Updated_at string `json:"updated_at"` // The date and time the role was last updated. + Id int64 `json:"id"` // The unique identifier of the role. + Organization GeneratedType_Nullable_simple_user `json:"organization"` // A GitHub user. + Source string `json:"source,omitempty"` // Source answers the question, "where did this role come from?" } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the repository property to target - Property_values []string `json:"property_values"` // The values to match for the repository property - Source string `json:"source,omitempty"` // The source of the repository property. Defaults to 'custom' if not specified. +// GeneratedType_Reaction_rollup represents the GeneratedType_Reaction_rollup schema from the OpenAPI specification +type GeneratedType_Reaction_rollup struct { + Hooray int `json:"hooray"` + Field1 int `json:"-1"` + Eyes int `json:"eyes"` + Heart int `json:"heart"` + Rocket int `json:"rocket"` + Total_count int `json:"total_count"` + Url string `json:"url"` + Laugh int `json:"laugh"` + Field1_1 int `json:"+1"` + Confused int `json:"confused"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Label Webhookslabel `json:"label,omitempty"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_sponsorship_pending_tier_change represents the GeneratedType_Webhook_sponsorship_pending_tier_change schema from the OpenAPI specification +type GeneratedType_Webhook_sponsorship_pending_tier_change struct { + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Effective_date string `json:"effective_date,omitempty"` // The `pending_cancellation` and `pending_tier_change` event types will include the date the cancellation or tier change will take effect. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sponsorship Webhookssponsorship `json:"sponsorship"` + Changes Webhookschanges8 `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// Package represents the Package schema from the OpenAPI specification -type Package struct { - Version_count int `json:"version_count"` // The number of versions of the package. - Html_url string `json:"html_url"` - Updated_at string `json:"updated_at"` - Name string `json:"name"` // The name of the package. - Package_type string `json:"package_type"` - Url string `json:"url"` - Owner GeneratedType `json:"owner,omitempty"` // A GitHub user. - Visibility string `json:"visibility"` - Created_at string `json:"created_at"` - Id int `json:"id"` // Unique identifier of the package. - Repository GeneratedType `json:"repository,omitempty"` // Minimal Repository +// GeneratedType_Custom_property represents the GeneratedType_Custom_property schema from the OpenAPI specification +type GeneratedType_Custom_property struct { + Allowed_values []string `json:"allowed_values,omitempty"` // An ordered list of the allowed values of the property. The property can have up to 200 allowed values. + Default_value string `json:"default_value,omitempty"` // Default value of the property + Required bool `json:"required,omitempty"` // Whether the property is required. + Source_type string `json:"source_type,omitempty"` // The source type of the property + Property_name string `json:"property_name"` // The name of the property + Url string `json:"url,omitempty"` // The URL that can be used to fetch, update, or delete info about this property via the API. + Value_type string `json:"value_type"` // The type of the value for the property + Values_editable_by string `json:"values_editable_by,omitempty"` // Who can edit the values of the property + Description string `json:"description,omitempty"` // Short description of the property } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. +// Webhookschanges represents the Webhookschanges schema from the OpenAPI specification +type Webhookschanges struct { + Body map[string]interface{} `json:"body,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Links map[string]interface{} `json:"_links,omitempty"` - Bypass_actors []GeneratedType `json:"bypass_actors,omitempty"` // The actors that can bypass the rules in this ruleset - Conditions interface{} `json:"conditions,omitempty"` - Enforcement string `json:"enforcement"` // The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise). - Source string `json:"source"` // The name of the source - Source_type string `json:"source_type,omitempty"` // The type of the source of the ruleset - Node_id string `json:"node_id,omitempty"` - Updated_at string `json:"updated_at,omitempty"` - Created_at string `json:"created_at,omitempty"` - Current_user_can_bypass string `json:"current_user_can_bypass,omitempty"` // The bypass type of the user making the API request for this ruleset. This field is only returned when querying the repository-level endpoint. - Id int `json:"id"` // The ID of the ruleset - Name string `json:"name"` // The name of the ruleset - Rules []GeneratedType `json:"rules,omitempty"` - Target string `json:"target,omitempty"` // The target of the ruleset +// GeneratedType_Check_run represents the GeneratedType_Check_run schema from the OpenAPI specification +type GeneratedType_Check_run struct { + Conclusion string `json:"conclusion"` + Url string `json:"url"` + Check_suite map[string]interface{} `json:"check_suite"` + Status string `json:"status"` // The phase of the lifecycle that the check is currently in. Statuses of waiting, requested, and pending are reserved for GitHub Actions check runs. + App GeneratedType_Nullable_integration `json:"app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Details_url string `json:"details_url"` + External_id string `json:"external_id"` + Head_sha string `json:"head_sha"` // The SHA of the commit that is being checked. + Id int64 `json:"id"` // The id of the check. + Output map[string]interface{} `json:"output"` + Html_url string `json:"html_url"` + Name string `json:"name"` // The name of the check. + Node_id string `json:"node_id"` + Started_at string `json:"started_at"` + Completed_at string `json:"completed_at"` + Pull_requests []GeneratedType_Pull_request_minimal `json:"pull_requests"` // Pull requests that are open with a `head_sha` or `head_branch` that matches the check. The returned pull requests do not necessarily indicate pull requests that triggered the check. + Deployment GeneratedType_Deployment_simple `json:"deployment,omitempty"` // A deployment created as the result of an Actions check run from a workflow that references an environment } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alerts_threshold string `json:"alerts_threshold"` // The severity level at which code scanning results that raise alerts block a reference update. For more information on alert severity levels, see "[About code scanning alerts](https://docs.github.com/code-security/code-scanning/managing-code-scanning-alerts/about-code-scanning-alerts#about-alert-severity-and-security-severity-levels)." - Security_alerts_threshold string `json:"security_alerts_threshold"` // The severity level at which code scanning results that raise security alerts block a reference update. For more information on security severity levels, see "[About code scanning alerts](https://docs.github.com/code-security/code-scanning/managing-code-scanning-alerts/about-code-scanning-alerts#about-alert-severity-and-security-severity-levels)." - Tool string `json:"tool"` // The name of a code scanning tool +// GeneratedType_Merge_group represents the GeneratedType_Merge_group schema from the OpenAPI specification +type GeneratedType_Merge_group struct { + Base_sha string `json:"base_sha"` // The SHA of the merge group's parent commit. + Head_commit GeneratedType_Simple_commit `json:"head_commit"` // A commit. + Head_ref string `json:"head_ref"` // The full ref of the merge group. + Head_sha string `json:"head_sha"` // The SHA of the merge group. + Base_ref string `json:"base_ref"` // The full ref of the branch the merge group will be merged into. +} + +// GeneratedType_Projects_v2 represents the GeneratedType_Projects_v2 schema from the OpenAPI specification +type GeneratedType_Projects_v2 struct { + Creator GeneratedType_Simple_user `json:"creator"` // A GitHub user. + Id float64 `json:"id"` + Short_description string `json:"short_description"` + Title string `json:"title"` + Deleted_at string `json:"deleted_at"` + Deleted_by GeneratedType_Nullable_simple_user `json:"deleted_by"` // A GitHub user. + Node_id string `json:"node_id"` + Public bool `json:"public"` + Updated_at string `json:"updated_at"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Description string `json:"description"` + Number int `json:"number"` + Closed_at string `json:"closed_at"` + Created_at string `json:"created_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request map[string]interface{} `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Review Webhooksreview `json:"review"` // The review that was affected. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Repository_collaborator_permission represents the GeneratedType_Repository_collaborator_permission schema from the OpenAPI specification +type GeneratedType_Repository_collaborator_permission struct { + Permission string `json:"permission"` + Role_name string `json:"role_name"` + User GeneratedType_Nullable_collaborator `json:"user"` // Collaborator } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Package_version represents the GeneratedType_Package_version schema from the OpenAPI specification +type GeneratedType_Package_version struct { + Url string `json:"url"` + Deleted_at string `json:"deleted_at,omitempty"` + Html_url string `json:"html_url,omitempty"` + Created_at string `json:"created_at"` + Id int `json:"id"` // Unique identifier of the package version. + License string `json:"license,omitempty"` + Name string `json:"name"` // The name of the package version. + Package_html_url string `json:"package_html_url"` + Description string `json:"description,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Updated_at string `json:"updated_at"` } -// License represents the License schema from the OpenAPI specification -type License struct { - Conditions []string `json:"conditions"` - Url string `json:"url"` - Description string `json:"description"` +// GeneratedType_Timeline_committed_event represents the GeneratedType_Timeline_committed_event schema from the OpenAPI specification +type GeneratedType_Timeline_committed_event struct { + Verification map[string]interface{} `json:"verification"` + Author map[string]interface{} `json:"author"` // Identifying information for the git-user + Message string `json:"message"` // Message describing the purpose of the commit + Committer map[string]interface{} `json:"committer"` // Identifying information for the git-user Html_url string `json:"html_url"` - Permissions []string `json:"permissions"` - Spdx_id string `json:"spdx_id"` - Implementation string `json:"implementation"` - Key string `json:"key"` - Limitations []string `json:"limitations"` - Body string `json:"body"` - Featured bool `json:"featured"` - Name string `json:"name"` + Tree map[string]interface{} `json:"tree"` + Event string `json:"event,omitempty"` Node_id string `json:"node_id"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { + Parents []map[string]interface{} `json:"parents"` + Sha string `json:"sha"` // SHA for the commit Url string `json:"url"` - Node_id string `json:"node_id"` - Object map[string]interface{} `json:"object"` - Ref string `json:"ref"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id,omitempty"` // Unique identifier of the label. - Name string `json:"name"` // Name of the label. - TypeField string `json:"type,omitempty"` // The type of label. Read-only labels are applied automatically when the runner is configured. +// GeneratedType_Actions_cache_usage_by_repository represents the GeneratedType_Actions_cache_usage_by_repository schema from the OpenAPI specification +type GeneratedType_Actions_cache_usage_by_repository struct { + Active_caches_count int `json:"active_caches_count"` // The number of active caches in the repository. + Active_caches_size_in_bytes int `json:"active_caches_size_in_bytes"` // The sum of the size in bytes of all the active cache items in the repository. + Full_name string `json:"full_name"` // The repository owner and name for the cache usage being shown. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Oid string `json:"oid"` // Full or abbreviated commit hash to reject - Reason string `json:"reason,omitempty"` // Reason for restriction +// GeneratedType_Webhook_issues_edited represents the GeneratedType_Webhook_issues_edited schema from the OpenAPI specification +type GeneratedType_Webhook_issues_edited struct { + Changes map[string]interface{} `json:"changes"` // The changes to the issue. + Label Webhookslabel `json:"label,omitempty"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alert GeneratedType `json:"alert"` // A Dependabot alert. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Gist_history represents the GeneratedType_Gist_history schema from the OpenAPI specification +type GeneratedType_Gist_history struct { + Url string `json:"url,omitempty"` + User GeneratedType_Nullable_simple_user `json:"user,omitempty"` // A GitHub user. + Version string `json:"version,omitempty"` + Change_status map[string]interface{} `json:"change_status,omitempty"` + Committed_at string `json:"committed_at,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Paused bool `json:"paused"` // Whether Dependabot security updates are paused for the repository. - Enabled bool `json:"enabled"` // Whether Dependabot security updates are enabled for the repository. +// GeneratedType_Merged_upstream represents the GeneratedType_Merged_upstream schema from the OpenAPI specification +type GeneratedType_Merged_upstream struct { + Merge_type string `json:"merge_type,omitempty"` + Message string `json:"message,omitempty"` + Base_branch string `json:"base_branch,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Ping_url string `json:"ping_url"` - Events []string `json:"events"` +// GeneratedType_Ruleset_version represents the GeneratedType_Ruleset_version schema from the OpenAPI specification +type GeneratedType_Ruleset_version struct { + Actor map[string]interface{} `json:"actor"` // The actor who updated the ruleset Updated_at string `json:"updated_at"` - Active bool `json:"active"` - Config map[string]interface{} `json:"config"` - Created_at string `json:"created_at"` - Deliveries_url string `json:"deliveries_url,omitempty"` - Name string `json:"name"` - TypeField string `json:"type"` - Url string `json:"url"` - Id int `json:"id"` + Version_id int `json:"version_id"` // The ID of the previous version of the ruleset } -// Environment represents the Environment schema from the OpenAPI specification -type Environment struct { - Deployment_branch_policy GeneratedType `json:"deployment_branch_policy,omitempty"` // The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`. - Html_url string `json:"html_url"` - Protection_rules []interface{} `json:"protection_rules,omitempty"` // Built-in deployment protection rules for the environment. - Created_at string `json:"created_at"` // The time that the environment was created, in ISO 8601 format. - Name string `json:"name"` // The name of the environment. - Url string `json:"url"` - Id int64 `json:"id"` // The id of the environment. +// GeneratedType_Timeline_reviewed_event represents the GeneratedType_Timeline_reviewed_event schema from the OpenAPI specification +type GeneratedType_Timeline_reviewed_event struct { + Body_html string `json:"body_html,omitempty"` + Event string `json:"event"` + Id int `json:"id"` // Unique identifier of the review + Body string `json:"body"` // The text of the review. + Body_text string `json:"body_text,omitempty"` Node_id string `json:"node_id"` - Updated_at string `json:"updated_at"` // The time that the environment was last updated, in ISO 8601 format. + Author_association string `json:"author_association"` // How the author is associated with the repository. + Commit_id string `json:"commit_id"` // A commit SHA for the review. + Html_url string `json:"html_url"` + Pull_request_url string `json:"pull_request_url"` + State string `json:"state"` + Submitted_at string `json:"submitted_at,omitempty"` + User GeneratedType_Simple_user `json:"user"` // A GitHub user. + Links map[string]interface{} `json:"_links"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation Installation `json:"installation"` // Installation - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requester interface{} `json:"requester,omitempty"` - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_discussion_unlocked represents the GeneratedType_Webhook_discussion_unlocked schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_unlocked struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +} + +// GeneratedType_Hook_delivery represents the GeneratedType_Hook_delivery schema from the OpenAPI specification +type GeneratedType_Hook_delivery struct { + Event string `json:"event"` // The event that triggered the delivery. + Guid string `json:"guid"` // Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event). + Status string `json:"status"` // Description of the status of the attempted delivery + Status_code int `json:"status_code"` // Status code received when delivery was made. + Url string `json:"url,omitempty"` // The URL target of the delivery. + Action string `json:"action"` // The type of activity for the event that triggered the delivery. + Id int `json:"id"` // Unique identifier of the delivery. + Installation_id int `json:"installation_id"` // The id of the GitHub App installation associated with this event. + Throttled_at string `json:"throttled_at,omitempty"` // Time when the webhook delivery was throttled. + Response map[string]interface{} `json:"response"` + Duration float64 `json:"duration"` // Time spent delivering. + Request map[string]interface{} `json:"request"` + Delivered_at string `json:"delivered_at"` // Time when the delivery was delivered. + Redelivery bool `json:"redelivery"` // Whether the delivery is a redelivery. + Repository_id int `json:"repository_id"` // The id of the repository associated with this event. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Personal_access_token_request GeneratedType `json:"personal_access_token_request"` // Details of a Personal Access Token Request. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_projects_v2_item_reordered represents the GeneratedType_Webhook_projects_v2_item_reordered schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_reordered struct { + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Changes map[string]interface{} `json:"changes"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Repository_rule_workflows represents the GeneratedType_Repository_rule_workflows schema from the OpenAPI specification +type GeneratedType_Repository_rule_workflows struct { Parameters map[string]interface{} `json:"parameters,omitempty"` TypeField string `json:"type"` } -// Hook represents the Hook schema from the OpenAPI specification -type Hook struct { - Deliveries_url string `json:"deliveries_url,omitempty"` - Last_response GeneratedType `json:"last_response"` - TypeField string `json:"type"` - Events []string `json:"events"` // Determines what events the hook is triggered for. Default: ['push']. +// Webhooksteam1 represents the Webhooksteam1 schema from the OpenAPI specification +type Webhooksteam1 struct { + Slug string `json:"slug,omitempty"` + Url string `json:"url,omitempty"` // URL for the team + Deleted bool `json:"deleted,omitempty"` + Id int `json:"id"` // Unique identifier of the team + Node_id string `json:"node_id,omitempty"` + Notification_setting string `json:"notification_setting,omitempty"` // Whether team members will receive notifications when their team is @mentioned + Privacy string `json:"privacy,omitempty"` + Html_url string `json:"html_url,omitempty"` + Members_url string `json:"members_url,omitempty"` + Parent map[string]interface{} `json:"parent,omitempty"` + Permission string `json:"permission,omitempty"` // Permission that the team will have for its repositories + Description string `json:"description,omitempty"` // Description of the team + Name string `json:"name"` // Name of the team + Repositories_url string `json:"repositories_url,omitempty"` +} + +// GeneratedType_Webhook_dependabot_alert_fixed represents the GeneratedType_Webhook_dependabot_alert_fixed schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_fixed struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +} + +// GeneratedType_Pull_request_review_comment represents the GeneratedType_Pull_request_review_comment schema from the OpenAPI specification +type GeneratedType_Pull_request_review_comment struct { + Path string `json:"path"` // The relative path of the file to which the comment applies. + Reactions GeneratedType_Reaction_rollup `json:"reactions,omitempty"` + Side string `json:"side,omitempty"` // The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment + Body_text string `json:"body_text,omitempty"` + Id int64 `json:"id"` // The ID of the pull request review comment. + User GeneratedType_Simple_user `json:"user"` // A GitHub user. + Start_line int `json:"start_line,omitempty"` // The first line of the range for a multi-line comment. Updated_at string `json:"updated_at"` - Config GeneratedType `json:"config"` // Configuration object of the webhook - Id int `json:"id"` // Unique identifier of the webhook. - Name string `json:"name"` // The name of a valid service, use 'web' for a webhook. - Ping_url string `json:"ping_url"` - Test_url string `json:"test_url"` - Url string `json:"url"` - Active bool `json:"active"` // Determines whether the hook is actually triggered on pushes. + Original_line int `json:"original_line,omitempty"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment + Commit_id string `json:"commit_id"` // The SHA of the commit to which the comment applies. + Html_url string `json:"html_url"` // HTML URL for the pull request review comment. + Pull_request_review_id int64 `json:"pull_request_review_id"` // The ID of the pull request review to which the comment belongs. + Url string `json:"url"` // URL for the pull request review comment + Pull_request_url string `json:"pull_request_url"` // URL for the pull request that the review comment belongs to. Created_at string `json:"created_at"` + Links map[string]interface{} `json:"_links"` + Position int `json:"position,omitempty"` // The line index in the diff to which the comment applies. This field is closing down; use `line` instead. + Line int `json:"line,omitempty"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment + Original_commit_id string `json:"original_commit_id"` // The SHA of the original commit to which the comment applies. + Subject_type string `json:"subject_type,omitempty"` // The level at which the comment is targeted, can be a diff line or a file. + Start_side string `json:"start_side,omitempty"` // The side of the first line of the range for a multi-line comment. + Diff_hunk string `json:"diff_hunk"` // The diff of the line that the comment refers to. + Body string `json:"body"` // The text of the comment. + Body_html string `json:"body_html,omitempty"` + Original_start_line int `json:"original_start_line,omitempty"` // The first line of the range for a multi-line comment. + Author_association string `json:"author_association"` // How the author is associated with the repository. + Original_position int `json:"original_position,omitempty"` // The index of the original line in the diff to which the comment applies. This field is closing down; use `original_line` instead. + In_reply_to_id int `json:"in_reply_to_id,omitempty"` // The comment ID to reply to. + Node_id string `json:"node_id"` // The node ID of the pull request review comment. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Simple_repository represents the GeneratedType_Simple_repository schema from the OpenAPI specification +type GeneratedType_Simple_repository struct { + Blobs_url string `json:"blobs_url"` // A template for the API URL to create or retrieve a raw Git blob in the repository. + Issues_url string `json:"issues_url"` // A template for the API URL to get information about issues on the repository. + Milestones_url string `json:"milestones_url"` // A template for the API URL to get information about milestones of the repository. + Assignees_url string `json:"assignees_url"` // A template for the API URL to list the available assignees for issues in the repository. + Deployments_url string `json:"deployments_url"` // The API URL to list the deployments of the repository. + Tags_url string `json:"tags_url"` // The API URL to get information about tags on the repository. + Html_url string `json:"html_url"` // The URL to view the repository on GitHub.com. + Git_commits_url string `json:"git_commits_url"` // A template for the API URL to get information about Git commits of the repository. + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Teams_url string `json:"teams_url"` // The API URL to list the teams on the repository. + Forks_url string `json:"forks_url"` // The API URL to list the forks of the repository. + Contributors_url string `json:"contributors_url"` // A template for the API URL to list the contributors to the repository. + Commits_url string `json:"commits_url"` // A template for the API URL to get information about commits on the repository. + Statuses_url string `json:"statuses_url"` // A template for the API URL to get information about statuses of a commit. + Notifications_url string `json:"notifications_url"` // A template for the API URL to get information about notifications on the repository. + Subscribers_url string `json:"subscribers_url"` // The API URL to list the subscribers on the repository. + Subscription_url string `json:"subscription_url"` // The API URL to subscribe to notifications for this repository. + Compare_url string `json:"compare_url"` // A template for the API URL to compare two commits or refs. + Issue_comment_url string `json:"issue_comment_url"` // A template for the API URL to get information about issue comments on the repository. + Branches_url string `json:"branches_url"` // A template for the API URL to get information about branches in the repository. + Keys_url string `json:"keys_url"` // A template for the API URL to get information about deploy keys on the repository. + Node_id string `json:"node_id"` // The GraphQL identifier of the repository. + Full_name string `json:"full_name"` // The full, globally unique, name of the repository. + Id int64 `json:"id"` // A unique identifier of the repository. + Fork bool `json:"fork"` // Whether the repository is a fork. + Releases_url string `json:"releases_url"` // A template for the API URL to get information about releases on the repository. + Labels_url string `json:"labels_url"` // A template for the API URL to get information about labels of the repository. + Private bool `json:"private"` // Whether the repository is private. + Archive_url string `json:"archive_url"` // A template for the API URL to download the repository as an archive. + Hooks_url string `json:"hooks_url"` // The API URL to list the hooks on the repository. + Events_url string `json:"events_url"` // The API URL to list the events of the repository. + Git_refs_url string `json:"git_refs_url"` // A template for the API URL to get information about Git refs of the repository. + Issue_events_url string `json:"issue_events_url"` // A template for the API URL to get information about issue events on the repository. + Languages_url string `json:"languages_url"` // The API URL to get information about the languages of the repository. + Name string `json:"name"` // The name of the repository. + Git_tags_url string `json:"git_tags_url"` // A template for the API URL to get information about Git tags of the repository. + Contents_url string `json:"contents_url"` // A template for the API URL to get the contents of the repository. + Collaborators_url string `json:"collaborators_url"` // A template for the API URL to get information about collaborators of the repository. + Merges_url string `json:"merges_url"` // The API URL to merge branches in the repository. + Downloads_url string `json:"downloads_url"` // The API URL to list the downloads on the repository. + Stargazers_url string `json:"stargazers_url"` // The API URL to list the stargazers on the repository. + Trees_url string `json:"trees_url"` // A template for the API URL to create or retrieve a raw Git tree of the repository. + Url string `json:"url"` // The URL to get more information about the repository from the GitHub API. + Pulls_url string `json:"pulls_url"` // A template for the API URL to get information about pull requests on the repository. + Comments_url string `json:"comments_url"` // A template for the API URL to get information about comments on the repository. + Description string `json:"description"` // The repository description. +} + +// GeneratedType_Team_role_assignment represents the GeneratedType_Team_role_assignment schema from the OpenAPI specification +type GeneratedType_Team_role_assignment struct { + Repositories_url string `json:"repositories_url"` + Parent GeneratedType_Nullable_team_simple `json:"parent"` // Groups of organization members that gives permissions on specified repositories. + Description string `json:"description"` + Members_url string `json:"members_url"` + Name string `json:"name"` + Url string `json:"url"` + Id int `json:"id"` + Notification_setting string `json:"notification_setting,omitempty"` + Privacy string `json:"privacy,omitempty"` + Node_id string `json:"node_id"` + Permission string `json:"permission"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Slug string `json:"slug"` + Assignment string `json:"assignment,omitempty"` // Determines if the team has a direct, indirect, or mixed relationship to a role + Html_url string `json:"html_url"` +} + +// GeneratedType_Project_card represents the GeneratedType_Project_card schema from the OpenAPI specification +type GeneratedType_Project_card struct { + Archived bool `json:"archived,omitempty"` // Whether or not the card is archived + Column_name string `json:"column_name,omitempty"` + Column_url string `json:"column_url"` + Content_url string `json:"content_url,omitempty"` + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. + Note string `json:"note"` + Project_url string `json:"project_url"` + Created_at string `json:"created_at"` + Updated_at string `json:"updated_at"` + Id int64 `json:"id"` // The project card's ID + Node_id string `json:"node_id"` + Project_id string `json:"project_id,omitempty"` + Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sha string `json:"sha"` - Links map[string]interface{} `json:"_links"` - Git_url string `json:"git_url"` - Html_url string `json:"html_url"` - Size int `json:"size"` - TypeField string `json:"type"` - Name string `json:"name"` +// GeneratedType_Check_annotation represents the GeneratedType_Check_annotation schema from the OpenAPI specification +type GeneratedType_Check_annotation struct { + Blob_href string `json:"blob_href"` + End_column int `json:"end_column"` + End_line int `json:"end_line"` Path string `json:"path"` - Submodule_git_url string `json:"submodule_git_url"` - Url string `json:"url"` - Download_url string `json:"download_url"` + Message string `json:"message"` + Raw_details string `json:"raw_details"` + Start_line int `json:"start_line"` + Title string `json:"title"` + Annotation_level string `json:"annotation_level"` + Start_column int `json:"start_column"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the machine. - Operating_system string `json:"operating_system"` // The operating system of the machine. - Prebuild_availability string `json:"prebuild_availability"` // Whether a prebuild is currently available when creating a codespace for this machine and repository. If a branch was not specified as a ref, the default branch will be assumed. Value will be "null" if prebuilds are not supported or prebuild availability could not be determined. Value will be "none" if no prebuild is available. Latest values "ready" and "in_progress" indicate the prebuild availability status. - Storage_in_bytes int `json:"storage_in_bytes"` // How much storage is available to the codespace. - Cpus int `json:"cpus"` // How many cores are available to the codespace. - Display_name string `json:"display_name"` // The display name of the machine includes cores, memory, and storage. - Memory_in_bytes int `json:"memory_in_bytes"` // How much memory is available to the codespace. +// GeneratedType_Webhook_projects_v2_project_closed represents the GeneratedType_Webhook_projects_v2_project_closed schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_project_closed struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2 GeneratedType_Projects_v2 `json:"projects_v2"` // A projects v2 project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Rate_limited_request_count int64 `json:"rate_limited_request_count,omitempty"` // The total number of requests that were rate limited within the queried time period - Total_request_count int64 `json:"total_request_count,omitempty"` // The total number of requests within the queried time period +// GeneratedType_Project_collaborator_permission represents the GeneratedType_Project_collaborator_permission schema from the OpenAPI specification +type GeneratedType_Project_collaborator_permission struct { + Permission string `json:"permission"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url,omitempty"` - Created_at string `json:"created_at,omitempty"` - Id int `json:"id,omitempty"` - Key string `json:"key"` // The Base64 encoded public key. - Key_id string `json:"key_id"` // The identifier for the key. - Title string `json:"title,omitempty"` +// GeneratedType_Team_simple represents the GeneratedType_Team_simple schema from the OpenAPI specification +type GeneratedType_Team_simple struct { + Repositories_url string `json:"repositories_url"` + Url string `json:"url"` // URL for the team + Members_url string `json:"members_url"` + Name string `json:"name"` // Name of the team + Permission string `json:"permission"` // Permission that the team will have for its repositories + Ldap_dn string `json:"ldap_dn,omitempty"` // Distinguished Name (DN) that team maps to within LDAP environment + Notification_setting string `json:"notification_setting,omitempty"` // The notification setting the team has set + Privacy string `json:"privacy,omitempty"` // The level of privacy this team should have + Slug string `json:"slug"` + Description string `json:"description"` // Description of the team + Html_url string `json:"html_url"` + Id int `json:"id"` // Unique identifier of the team + Node_id string `json:"node_id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Project_node_id string `json:"project_node_id,omitempty"` - Archived_at string `json:"archived_at"` - Created_at string `json:"created_at"` - Creator GeneratedType `json:"creator,omitempty"` // A GitHub user. - Id float64 `json:"id"` - Node_id string `json:"node_id,omitempty"` - Content_type string `json:"content_type"` // The type of content tracked in a project item - Updated_at string `json:"updated_at"` - Content_node_id string `json:"content_node_id"` +// GeneratedType_Webhook_create represents the GeneratedType_Webhook_create schema from the OpenAPI specification +type GeneratedType_Webhook_create struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Pusher_type string `json:"pusher_type"` // The pusher type for the event. Can be either `user` or a deploy key. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Ref string `json:"ref"` // The [`git ref`](https://docs.github.com/rest/git/refs#get-a-reference) resource. + Ref_type string `json:"ref_type"` // The type of Git ref object created in the repository. + Description string `json:"description"` // The repository's current description. + Master_branch string `json:"master_branch"` // The name of the repository's default branch (usually `main`). } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_issues_transferred represents the GeneratedType_Webhook_issues_transferred schema from the OpenAPI specification +type GeneratedType_Webhook_issues_transferred struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue Webhooksissue2 `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Payload string `json:"payload"` // A URL-encoded string of the secret_scanning_alert_location.created JSON payload. The decoded payload is a JSON object. +// GeneratedType_Actions_hosted_runner_image represents the GeneratedType_Actions_hosted_runner_image schema from the OpenAPI specification +type GeneratedType_Actions_hosted_runner_image struct { + Source string `json:"source"` // The image provider. + Display_name string `json:"display_name"` // Display name for this image. + Id string `json:"id"` // The ID of the image. Use this ID for the `image` parameter when creating a new larger runner. + Platform string `json:"platform"` // The operating system of the image. + Size_gb int `json:"size_gb"` // Image size in GB. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. - Parent_issue_repo Repository `json:"parent_issue_repo"` // A repository on GitHub. - Action string `json:"action"` - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Ruleset_version_with_state represents the GeneratedType_Ruleset_version_with_state schema from the OpenAPI specification +type GeneratedType_Ruleset_version_with_state struct { + Actor map[string]interface{} `json:"actor"` // The actor who updated the ruleset + Updated_at string `json:"updated_at"` + Version_id int `json:"version_id"` // The ID of the previous version of the ruleset + State map[string]interface{} `json:"state"` // The state of the ruleset version } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_id map[string]interface{} `json:"repository_id"` +// GeneratedType_Webhook_workflow_dispatch represents the GeneratedType_Webhook_workflow_dispatch schema from the OpenAPI specification +type GeneratedType_Webhook_workflow_dispatch struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Ref string `json:"ref"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Workflow string `json:"workflow"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Inputs map[string]interface{} `json:"inputs"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Dismiss_stale_reviews bool `json:"dismiss_stale_reviews"` - Dismissal_restrictions map[string]interface{} `json:"dismissal_restrictions,omitempty"` - Require_code_owner_reviews bool `json:"require_code_owner_reviews"` - Require_last_push_approval bool `json:"require_last_push_approval,omitempty"` // Whether the most recent push must be approved by someone other than the person who pushed it. - Required_approving_review_count int `json:"required_approving_review_count,omitempty"` - Url string `json:"url,omitempty"` - Bypass_pull_request_allowances map[string]interface{} `json:"bypass_pull_request_allowances,omitempty"` // Allow specific users, teams, or apps to bypass pull request requirements. +// GeneratedType_Webhook_projects_v2_item_edited represents the GeneratedType_Webhook_projects_v2_item_edited schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_item_edited struct { + Action string `json:"action"` + Changes interface{} `json:"changes,omitempty"` // The changes made to the item may involve modifications in the item's fields and draft issue body. It includes altered values for text, number, date, single select, and iteration fields, along with the GraphQL node ID of the changed field. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_item GeneratedType_Projects_v2_item `json:"projects_v2_item"` // An item belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// Webhooksdeploykey represents the Webhooksdeploykey schema from the OpenAPI specification -type Webhooksdeploykey struct { - Last_used string `json:"last_used,omitempty"` - Added_by string `json:"added_by,omitempty"` - Id int `json:"id"` - Read_only bool `json:"read_only"` - Title string `json:"title"` - Key string `json:"key"` - Url string `json:"url"` - Verified bool `json:"verified"` - Enabled bool `json:"enabled,omitempty"` +// GeneratedType_Org_private_registry_configuration represents the GeneratedType_Org_private_registry_configuration schema from the OpenAPI specification +type GeneratedType_Org_private_registry_configuration struct { + Registry_type string `json:"registry_type"` // The registry type. + Updated_at string `json:"updated_at"` + Username string `json:"username,omitempty"` // The username to use when authenticating with the private registry. + Visibility string `json:"visibility"` // Which type of organization repositories have access to the private registry. Created_at string `json:"created_at"` + Name string `json:"name"` // The name of the private registry configuration. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - Parent_issue_repo Repository `json:"parent_issue_repo"` // A repository on GitHub. - Action string `json:"action"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField GeneratedType `json:"type"` // The type of issue. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Code_search_result_item represents the GeneratedType_Code_search_result_item schema from the OpenAPI specification +type GeneratedType_Code_search_result_item struct { + Url string `json:"url"` + File_size int `json:"file_size,omitempty"` + Git_url string `json:"git_url"` + Html_url string `json:"html_url"` + Name string `json:"name"` + Repository GeneratedType_Minimal_repository `json:"repository"` // Minimal Repository + Line_numbers []string `json:"line_numbers,omitempty"` + Sha string `json:"sha"` + Path string `json:"path"` + Language string `json:"language,omitempty"` + Last_modified_at string `json:"last_modified_at,omitempty"` + Score float64 `json:"score"` + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Message string `json:"message,omitempty"` - Base_branch string `json:"base_branch,omitempty"` - Merge_type string `json:"merge_type,omitempty"` +// GeneratedType_User_search_result_item represents the GeneratedType_User_search_result_item schema from the OpenAPI specification +type GeneratedType_User_search_result_item struct { + Events_url string `json:"events_url"` + Location string `json:"location,omitempty"` + Followers int `json:"followers,omitempty"` + Id int64 `json:"id"` + Public_gists int `json:"public_gists,omitempty"` + Text_matches []map[string]interface{} `json:"text_matches,omitempty"` + Node_id string `json:"node_id"` + Html_url string `json:"html_url"` + Suspended_at string `json:"suspended_at,omitempty"` + Following_url string `json:"following_url"` + Email string `json:"email,omitempty"` + Hireable bool `json:"hireable,omitempty"` + Url string `json:"url"` + Subscriptions_url string `json:"subscriptions_url"` + Blog string `json:"blog,omitempty"` + Organizations_url string `json:"organizations_url"` + Public_repos int `json:"public_repos,omitempty"` + Followers_url string `json:"followers_url"` + Gists_url string `json:"gists_url"` + TypeField string `json:"type"` + Updated_at string `json:"updated_at,omitempty"` + Score float64 `json:"score"` + Created_at string `json:"created_at,omitempty"` + Site_admin bool `json:"site_admin"` + Gravatar_id string `json:"gravatar_id"` + Name string `json:"name,omitempty"` + Repos_url string `json:"repos_url"` + Company string `json:"company,omitempty"` + Login string `json:"login"` + Starred_url string `json:"starred_url"` + User_view_type string `json:"user_view_type,omitempty"` + Following int `json:"following,omitempty"` + Bio string `json:"bio,omitempty"` + Received_events_url string `json:"received_events_url"` + Avatar_url string `json:"avatar_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// Stargazer represents the Stargazer schema from the OpenAPI specification +type Stargazer struct { + Starred_at string `json:"starred_at"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. } -// Dependency represents the Dependency schema from the OpenAPI specification -type Dependency struct { - Dependencies []string `json:"dependencies,omitempty"` // Array of package-url (PURLs) of direct child dependencies. - Metadata Metadata `json:"metadata,omitempty"` // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. - Package_url string `json:"package_url,omitempty"` // Package-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details. - Relationship string `json:"relationship,omitempty"` // A notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency. - Scope string `json:"scope,omitempty"` // A notation of whether the dependency is required for the primary build artifact (runtime) or is only used for development. Future versions of this specification may allow for more granular scopes. +// GeneratedType_Runner_application represents the GeneratedType_Runner_application schema from the OpenAPI specification +type GeneratedType_Runner_application struct { + Download_url string `json:"download_url"` + Filename string `json:"filename"` + Os string `json:"os"` + Sha256_checksum string `json:"sha256_checksum,omitempty"` + Temp_download_token string `json:"temp_download_token,omitempty"` // A short lived bearer token used to download the runner, if needed. + Architecture string `json:"architecture"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_job map[string]interface{} `json:"workflow_job"` - Action string `json:"action"` - Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Repository_webhooks represents the GeneratedType_Repository_webhooks schema from the OpenAPI specification +type GeneratedType_Repository_webhooks struct { + Pushed_at string `json:"pushed_at"` + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. + Labels_url string `json:"labels_url"` + Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. + Description string `json:"description"` + Watchers_count int `json:"watchers_count"` + Issues_url string `json:"issues_url"` + Teams_url string `json:"teams_url"` + Created_at string `json:"created_at"` + Subscribers_url string `json:"subscribers_url"` + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. + Has_projects bool `json:"has_projects"` // Whether projects are enabled. + Subscribers_count int `json:"subscribers_count,omitempty"` + Contents_url string `json:"contents_url"` + Default_branch string `json:"default_branch"` // The default branch of the repository. + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo + Keys_url string `json:"keys_url"` + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. + Releases_url string `json:"releases_url"` + Deployments_url string `json:"deployments_url"` + Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). + Id int64 `json:"id"` // Unique identifier of the repository + Url string `json:"url"` + Organization GeneratedType_Nullable_simple_user `json:"organization,omitempty"` // A GitHub user. + Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. + Archive_url string `json:"archive_url"` + Template_repository map[string]interface{} `json:"template_repository,omitempty"` + Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. + Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. + Issue_events_url string `json:"issue_events_url"` + Topics []string `json:"topics,omitempty"` + Events_url string `json:"events_url"` + Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository + Svn_url string `json:"svn_url"` + Assignees_url string `json:"assignees_url"` + Forks_url string `json:"forks_url"` + Statuses_url string `json:"statuses_url"` + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Tags_url string `json:"tags_url"` + Starred_at string `json:"starred_at,omitempty"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Open_issues int `json:"open_issues"` + Open_issues_count int `json:"open_issues_count"` + Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). + Blobs_url string `json:"blobs_url"` + Branches_url string `json:"branches_url"` + Compare_url string `json:"compare_url"` + Pulls_url string `json:"pulls_url"` + Git_refs_url string `json:"git_refs_url"` + Html_url string `json:"html_url"` + Master_branch string `json:"master_branch,omitempty"` + Has_issues bool `json:"has_issues"` // Whether issues are enabled. + Issue_comment_url string `json:"issue_comment_url"` + Subscription_url string `json:"subscription_url"` + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Archived bool `json:"archived"` // Whether the repository is archived. + Language string `json:"language"` + Private bool `json:"private"` // Whether the repository is private or public. + Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. + Fork bool `json:"fork"` + Mirror_url string `json:"mirror_url"` + Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Has_pages bool `json:"has_pages"` + Notifications_url string `json:"notifications_url"` + Collaborators_url string `json:"collaborators_url"` + Trees_url string `json:"trees_url"` + Ssh_url string `json:"ssh_url"` + Updated_at string `json:"updated_at"` + Languages_url string `json:"languages_url"` + Milestones_url string `json:"milestones_url"` + Clone_url string `json:"clone_url"` + Git_commits_url string `json:"git_commits_url"` + Stargazers_count int `json:"stargazers_count"` + Forks_count int `json:"forks_count"` + Commits_url string `json:"commits_url"` + Git_tags_url string `json:"git_tags_url"` + Contributors_url string `json:"contributors_url"` + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. + Hooks_url string `json:"hooks_url"` + Forks int `json:"forks"` + Downloads_url string `json:"downloads_url"` + Full_name string `json:"full_name"` + Name string `json:"name"` // The name of the repository. + Merges_url string `json:"merges_url"` + Node_id string `json:"node_id"` + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Homepage string `json:"homepage"` + Stargazers_url string `json:"stargazers_url"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Comments_url string `json:"comments_url"` + Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged + Git_url string `json:"git_url"` + Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. + Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. + Network_count int `json:"network_count,omitempty"` + Watchers int `json:"watchers"` } -// Webhookslabel represents the Webhookslabel schema from the OpenAPI specification -type Webhookslabel struct { - Color string `json:"color"` // 6-character hex code, without the leading #, identifying the color - DefaultField bool `json:"default"` +// GeneratedType_Nullable_organization_simple represents the GeneratedType_Nullable_organization_simple schema from the OpenAPI specification +type GeneratedType_Nullable_organization_simple struct { + Avatar_url string `json:"avatar_url"` Description string `json:"description"` + Events_url string `json:"events_url"` + Issues_url string `json:"issues_url"` + Members_url string `json:"members_url"` + Url string `json:"url"` + Hooks_url string `json:"hooks_url"` Id int `json:"id"` - Name string `json:"name"` // The name of the label. + Login string `json:"login"` Node_id string `json:"node_id"` - Url string `json:"url"` // URL for the label + Public_members_url string `json:"public_members_url"` + Repos_url string `json:"repos_url"` } -// Issue represents the Issue schema from the OpenAPI specification -type Issue struct { - State string `json:"state"` // State of the issue; either 'open' or 'closed' - Labels_url string `json:"labels_url"` - Reactions GeneratedType `json:"reactions,omitempty"` - Events_url string `json:"events_url"` - Closed_by GeneratedType `json:"closed_by,omitempty"` // A GitHub user. - Updated_at string `json:"updated_at"` - Repository_url string `json:"repository_url"` - Locked bool `json:"locked"` - Comments int `json:"comments"` - Comments_url string `json:"comments_url"` - Url string `json:"url"` // URL for the issue - Created_at string `json:"created_at"` - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - State_reason string `json:"state_reason,omitempty"` // The reason for the current state - User GeneratedType `json:"user"` // A GitHub user. - Sub_issues_summary GeneratedType `json:"sub_issues_summary,omitempty"` - Repository Repository `json:"repository,omitempty"` // A repository on GitHub. - Body_text string `json:"body_text,omitempty"` - Id int64 `json:"id"` - Active_lock_reason string `json:"active_lock_reason,omitempty"` - Draft bool `json:"draft,omitempty"` - Assignees []GeneratedType `json:"assignees,omitempty"` - Pull_request map[string]interface{} `json:"pull_request,omitempty"` - Body string `json:"body,omitempty"` // Contents of the issue - Html_url string `json:"html_url"` - Labels []interface{} `json:"labels"` // Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository - Milestone GeneratedType `json:"milestone"` // A collection of related issues and pull requests. - Node_id string `json:"node_id"` - Number int `json:"number"` // Number uniquely identifying the issue within its repository - Title string `json:"title"` // Title of the issue - TypeField GeneratedType `json:"type,omitempty"` // The type of issue. - Closed_at string `json:"closed_at"` - Timeline_url string `json:"timeline_url,omitempty"` - Body_html string `json:"body_html,omitempty"` - Author_association string `json:"author_association"` // How the author is associated with the repository. +// GeneratedType_Actions_repository_permissions represents the GeneratedType_Actions_repository_permissions schema from the OpenAPI specification +type GeneratedType_Actions_repository_permissions struct { + Enabled bool `json:"enabled"` // Whether GitHub Actions is enabled on the repository. + Selected_actions_url string `json:"selected_actions_url,omitempty"` // The API URL to use to get or set the actions and reusable workflows that are allowed to run, when `allowed_actions` is set to `selected`. + Allowed_actions string `json:"allowed_actions,omitempty"` // The permissions policy that controls the actions and reusable workflows that are allowed to run. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_url string `json:"commit_url"` - Node_id string `json:"node_id"` - Event string `json:"event"` - Label map[string]interface{} `json:"label"` - Id int `json:"id"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Url string `json:"url"` - Commit_id string `json:"commit_id"` - Created_at string `json:"created_at"` - Actor GeneratedType `json:"actor"` // A GitHub user. +// GeneratedType_Referrer_traffic represents the GeneratedType_Referrer_traffic schema from the OpenAPI specification +type GeneratedType_Referrer_traffic struct { + Referrer string `json:"referrer"` + Uniques int `json:"uniques"` + Count int `json:"count"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Gravatar_id string `json:"gravatar_id"` - User_view_type string `json:"user_view_type,omitempty"` - Subscriptions_url string `json:"subscriptions_url"` - Login string `json:"login"` - Organizations_url string `json:"organizations_url"` - Name string `json:"name,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Nullable_repository_webhooks represents the GeneratedType_Nullable_repository_webhooks schema from the OpenAPI specification +type GeneratedType_Nullable_repository_webhooks struct { + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Issue_comment_url string `json:"issue_comment_url"` + Milestones_url string `json:"milestones_url"` + Master_branch string `json:"master_branch,omitempty"` + Collaborators_url string `json:"collaborators_url"` + Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). + Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. + Network_count int `json:"network_count,omitempty"` + Subscribers_count int `json:"subscribers_count,omitempty"` + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. + Clone_url string `json:"clone_url"` + Archive_url string `json:"archive_url"` + Git_commits_url string `json:"git_commits_url"` + Comments_url string `json:"comments_url"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Created_at string `json:"created_at"` + Deployments_url string `json:"deployments_url"` + Subscription_url string `json:"subscription_url"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Pushed_at string `json:"pushed_at"` + Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. + Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository + Commits_url string `json:"commits_url"` + Assignees_url string `json:"assignees_url"` + Template_repository map[string]interface{} `json:"template_repository,omitempty"` + Forks_count int `json:"forks_count"` + Hooks_url string `json:"hooks_url"` + Contributors_url string `json:"contributors_url"` + Statuses_url string `json:"statuses_url"` + Stargazers_count int `json:"stargazers_count"` + Watchers int `json:"watchers"` + Labels_url string `json:"labels_url"` + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Languages_url string `json:"languages_url"` + Mirror_url string `json:"mirror_url"` + Notifications_url string `json:"notifications_url"` + Trees_url string `json:"trees_url"` + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. + Git_tags_url string `json:"git_tags_url"` + Name string `json:"name"` // The name of the repository. + Full_name string `json:"full_name"` + Issues_url string `json:"issues_url"` + Ssh_url string `json:"ssh_url"` + Id int64 `json:"id"` // Unique identifier of the repository + Keys_url string `json:"keys_url"` + Forks int `json:"forks"` + Url string `json:"url"` + Stargazers_url string `json:"stargazers_url"` + Has_projects bool `json:"has_projects"` // Whether projects are enabled. + Issue_events_url string `json:"issue_events_url"` + Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. + Pulls_url string `json:"pulls_url"` + Open_issues int `json:"open_issues"` + Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. + Homepage string `json:"homepage"` + Blobs_url string `json:"blobs_url"` + Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. + Updated_at string `json:"updated_at"` + Releases_url string `json:"releases_url"` + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. Node_id string `json:"node_id"` - Received_events_url string `json:"received_events_url"` - Followers_url string `json:"followers_url"` - Following_url string `json:"following_url"` - Repos_url string `json:"repos_url"` - Events_url string `json:"events_url"` + Description string `json:"description"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Svn_url string `json:"svn_url"` + Archived bool `json:"archived"` // Whether the repository is archived. + Has_issues bool `json:"has_issues"` // Whether issues are enabled. + Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo + Compare_url string `json:"compare_url"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Private bool `json:"private"` // Whether the repository is private or public. + Branches_url string `json:"branches_url"` + Git_refs_url string `json:"git_refs_url"` + Open_issues_count int `json:"open_issues_count"` Html_url string `json:"html_url"` - Id int64 `json:"id"` + Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. + Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. + Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. + Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). + Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. + Teams_url string `json:"teams_url"` + Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. + Language string `json:"language"` + Organization GeneratedType_Nullable_simple_user `json:"organization,omitempty"` // A GitHub user. + Git_url string `json:"git_url"` + Forks_url string `json:"forks_url"` + Fork bool `json:"fork"` + Has_pages bool `json:"has_pages"` + Merges_url string `json:"merges_url"` + Contents_url string `json:"contents_url"` + Tags_url string `json:"tags_url"` + Subscribers_url string `json:"subscribers_url"` Starred_at string `json:"starred_at,omitempty"` - Email string `json:"email,omitempty"` - Url string `json:"url"` - Avatar_url string `json:"avatar_url"` - Site_admin bool `json:"site_admin"` - Gists_url string `json:"gists_url"` - Starred_url string `json:"starred_url"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Version_id int `json:"version_id"` // The ID of the previous version of the ruleset - Actor map[string]interface{} `json:"actor"` // The actor who updated the ruleset - Updated_at string `json:"updated_at"` - State map[string]interface{} `json:"state"` // The state of the ruleset version -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { + Downloads_url string `json:"downloads_url"` + Watchers_count int `json:"watchers_count"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged + Topics []string `json:"topics,omitempty"` + Default_branch string `json:"default_branch"` // The default branch of the repository. + Events_url string `json:"events_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Deadline string `json:"deadline"` // The time at which the assignment is due. - Editor string `json:"editor"` // The selected editor for the assignment. - Feedback_pull_requests_enabled bool `json:"feedback_pull_requests_enabled"` // Whether feedback pull request will be created when a student accepts the assignment. - Max_teams int `json:"max_teams"` // The maximum allowable teams for the assignment. - Starter_code_repository GeneratedType `json:"starter_code_repository"` // A GitHub repository view for Classroom - Classroom Classroom `json:"classroom"` // A GitHub Classroom classroom - Passing int `json:"passing"` // The number of students that have passed the assignment. - Title string `json:"title"` // Assignment title. - Accepted int `json:"accepted"` // The number of students that have accepted the assignment. - Invitations_enabled bool `json:"invitations_enabled"` // Whether the invitation link is enabled. Visiting an enabled invitation link will accept the assignment. - Invite_link string `json:"invite_link"` // The link that a student can use to accept the assignment. - Id int `json:"id"` // Unique identifier of the repository. - Submitted int `json:"submitted"` // The number of students that have submitted the assignment. - TypeField string `json:"type"` // Whether it's a group assignment or individual assignment. - Max_members int `json:"max_members"` // The maximum allowable members per team. - Public_repo bool `json:"public_repo"` // Whether an accepted assignment creates a public repository. - Slug string `json:"slug"` // Sluggified name of the assignment. - Students_are_repo_admins bool `json:"students_are_repo_admins"` // Whether students are admins on created repository when a student accepts the assignment. - Language string `json:"language"` // The programming language used in the assignment. +// GeneratedType_Copilot_organization_seat_breakdown represents the GeneratedType_Copilot_organization_seat_breakdown schema from the OpenAPI specification +type GeneratedType_Copilot_organization_seat_breakdown struct { + Active_this_cycle int `json:"active_this_cycle,omitempty"` // The number of seats that have used Copilot during the current billing cycle. + Added_this_cycle int `json:"added_this_cycle,omitempty"` // Seats added during the current billing cycle. + Inactive_this_cycle int `json:"inactive_this_cycle,omitempty"` // The number of seats that have not used Copilot during the current billing cycle. + Pending_cancellation int `json:"pending_cancellation,omitempty"` // The number of seats that are pending cancellation at the end of the current billing cycle. + Pending_invitation int `json:"pending_invitation,omitempty"` // The number of users who have been invited to receive a Copilot seat through this organization. + Total int `json:"total,omitempty"` // The total number of seats being billed for the organization as of the current billing cycle. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Pull_request_comment_url string `json:"pull_request_comment_url"` // The API URL to get the pull request comment where the secret was detected. +// GeneratedType_Webhook_status represents the GeneratedType_Webhook_status schema from the OpenAPI specification +type GeneratedType_Webhook_status struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sha string `json:"sha"` // The Commit SHA. + Updated_at string `json:"updated_at"` + Commit map[string]interface{} `json:"commit"` + Description string `json:"description"` // The optional human-readable description added to the status. + State string `json:"state"` // The new state. Can be `pending`, `success`, `failure`, or `error`. + Id int `json:"id"` // The unique identifier of the status. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Branches []map[string]interface{} `json:"branches"` // An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches. + Created_at string `json:"created_at"` + Target_url string `json:"target_url"` // The optional link added to the status. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Avatar_url string `json:"avatar_url,omitempty"` + Context string `json:"context"` + Name string `json:"name"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Changes map[string]interface{} `json:"changes,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Repository_ruleset GeneratedType `json:"repository_ruleset"` // A set of rules to apply when specified conditions are met. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_custom_property_deleted represents the GeneratedType_Webhook_custom_property_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_custom_property_deleted struct { + Definition map[string]interface{} `json:"definition"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url"` - Base map[string]interface{} `json:"base"` - Head map[string]interface{} `json:"head"` - Id int64 `json:"id"` +// GeneratedType_Webhook_pull_request_auto_merge_enabled represents the GeneratedType_Webhook_pull_request_auto_merge_enabled schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_auto_merge_enabled struct { + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Pull_request map[string]interface{} `json:"pull_request"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." Number int `json:"number"` + Reason string `json:"reason,omitempty"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Action string `json:"action"` } -// Webhookspreviousmarketplacepurchase represents the Webhookspreviousmarketplacepurchase schema from the OpenAPI specification -type Webhookspreviousmarketplacepurchase struct { - Plan map[string]interface{} `json:"plan"` - Unit_count int `json:"unit_count"` - Account map[string]interface{} `json:"account"` - Billing_cycle string `json:"billing_cycle"` - Free_trial_ends_on interface{} `json:"free_trial_ends_on"` - Next_billing_date string `json:"next_billing_date,omitempty"` - On_free_trial bool `json:"on_free_trial"` +// GeneratedType_Oidc_custom_sub represents the GeneratedType_Oidc_custom_sub schema from the OpenAPI specification +type GeneratedType_Oidc_custom_sub struct { + Include_claim_keys []string `json:"include_claim_keys"` // Array of unique strings. Each claim key can only contain alphanumeric characters and underscores. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository_name map[string]interface{} `json:"repository_name"` +// GeneratedType_Webhook_discussion_unanswered represents the GeneratedType_Webhook_discussion_unanswered schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_unanswered struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Old_answer Webhooksanswer `json:"old_answer"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_id string `json:"commit_id"` - Created_at string `json:"created_at"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Url string `json:"url"` - Commit_url string `json:"commit_url"` - Id int `json:"id"` - Project_card map[string]interface{} `json:"project_card,omitempty"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Node_id string `json:"node_id"` - Event string `json:"event"` +// GeneratedType_Webhook_custom_property_created represents the GeneratedType_Webhook_custom_property_created schema from the OpenAPI specification +type GeneratedType_Webhook_custom_property_created struct { + Action string `json:"action"` + Definition GeneratedType_Custom_property `json:"definition"` // Custom property defined on an organization + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_job map[string]interface{} `json:"workflow_job"` +// GeneratedType_Webhook_registry_package_updated represents the GeneratedType_Webhook_registry_package_updated schema from the OpenAPI specification +type GeneratedType_Webhook_registry_package_updated struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Registry_package map[string]interface{} `json:"registry_package"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Guid string `json:"guid,omitempty"` // The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data. - Name string `json:"name,omitempty"` // The name of the tool used to generate the code scanning analysis. - Version string `json:"version,omitempty"` // The version of the tool used to generate the code scanning analysis. +// GeneratedType_Api_overview represents the GeneratedType_Api_overview schema from the OpenAPI specification +type GeneratedType_Api_overview struct { + Github_enterprise_importer []string `json:"github_enterprise_importer,omitempty"` + Importer []string `json:"importer,omitempty"` + Web []string `json:"web,omitempty"` + Verifiable_password_authentication bool `json:"verifiable_password_authentication"` + Actions []string `json:"actions,omitempty"` + Codespaces []string `json:"codespaces,omitempty"` + Packages []string `json:"packages,omitempty"` + Ssh_keys []string `json:"ssh_keys,omitempty"` + Hooks []string `json:"hooks,omitempty"` + Domains map[string]interface{} `json:"domains,omitempty"` + Ssh_key_fingerprints map[string]interface{} `json:"ssh_key_fingerprints,omitempty"` + Dependabot []string `json:"dependabot,omitempty"` + Api []string `json:"api,omitempty"` + Copilot []string `json:"copilot,omitempty"` + Actions_macos []string `json:"actions_macos,omitempty"` + Pages []string `json:"pages,omitempty"` + Git []string `json:"git,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Details interface{} `json:"details,omitempty"` - TypeField string `json:"type,omitempty"` // The location type. Because secrets may be found in different types of resources (ie. code, comments, issues, pull requests, discussions), this field identifies the type of resource where the secret was found. +// GeneratedType_Webhook_pull_request_unlabeled represents the GeneratedType_Webhook_pull_request_unlabeled schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_unlabeled struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Label Webhookslabel `json:"label,omitempty"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Number int `json:"number"` // The pull request number. + Pull_request map[string]interface{} `json:"pull_request"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation Installation `json:"installation"` // Installation - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requester Webhooksuser `json:"requester,omitempty"` - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_check_suite_completed represents the GeneratedType_Webhook_check_suite_completed schema from the OpenAPI specification +type GeneratedType_Webhook_check_suite_completed struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Check_suite map[string]interface{} `json:"check_suite"` // The [check_suite](https://docs.github.com/rest/checks/suites#get-a-check-suite). + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_organization_member_added represents the GeneratedType_Webhook_organization_member_added schema from the OpenAPI specification +type GeneratedType_Webhook_organization_member_added struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Membership Webhooksmembership `json:"membership"` // The membership between the user and the organization. Not present when the action is `member_invited`. + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation Installation `json:"installation"` // Installation - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Requester interface{} `json:"requester,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_deployment_status_created represents the GeneratedType_Webhook_deployment_status_created schema from the OpenAPI specification +type GeneratedType_Webhook_deployment_status_created struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Workflow Webhooksworkflow `json:"workflow,omitempty"` + Workflow_run map[string]interface{} `json:"workflow_run,omitempty"` Action string `json:"action"` - Changes interface{} `json:"changes,omitempty"` // The changes made to the item may involve modifications in the item's fields and draft issue body. It includes altered values for text, number, date, single select, and iteration fields, along with the GraphQL node ID of the changed field. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Deployment map[string]interface{} `json:"deployment"` // The [deployment](https://docs.github.com/rest/deployments/deployments#list-deployments). + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Deployment_status map[string]interface{} `json:"deployment_status"` // The [deployment status](https://docs.github.com/rest/deployments/statuses#list-deployment-statuses). + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Check_run map[string]interface{} `json:"check_run,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Sponsorship Webhookssponsorship `json:"sponsorship"` +// GeneratedType_Repository_rule_required_signatures represents the GeneratedType_Repository_rule_required_signatures schema from the OpenAPI specification +type GeneratedType_Repository_rule_required_signatures struct { + TypeField string `json:"type"` +} + +// GeneratedType_Dependabot_repository_access_details represents the GeneratedType_Dependabot_repository_access_details schema from the OpenAPI specification +type GeneratedType_Dependabot_repository_access_details struct { + Accessible_repositories []GeneratedType_Nullable_simple_repository `json:"accessible_repositories,omitempty"` + Default_level string `json:"default_level,omitempty"` // The default repository access level for Dependabot updates. +} + +// GeneratedType_Webhook_release_edited represents the GeneratedType_Webhook_release_edited schema from the OpenAPI specification +type GeneratedType_Webhook_release_edited struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. Action string `json:"action"` - Effective_date string `json:"effective_date,omitempty"` // The `pending_cancellation` and `pending_tier_change` event types will include the date the cancellation or tier change will take effect. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Since string `json:"since"` - Workflow_job_runs []map[string]interface{} `json:"workflow_job_runs,omitempty"` - Workflow_run map[string]interface{} `json:"workflow_run"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. +// GeneratedType_Webhook_issues_milestoned represents the GeneratedType_Webhook_issues_milestoned schema from the OpenAPI specification +type GeneratedType_Webhook_issues_milestoned struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Comment string `json:"comment,omitempty"` - Reviewers []map[string]interface{} `json:"reviewers,omitempty"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_job_run Webhooksworkflowjobrun `json:"workflow_job_run,omitempty"` - Approver Webhooksapprover `json:"approver,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Milestone Webhooksmilestone `json:"milestone"` // A collection of related issues and pull requests. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actor GeneratedType `json:"actor"` // A GitHub user. +// GeneratedType_Renamed_issue_event represents the GeneratedType_Renamed_issue_event schema from the OpenAPI specification +type GeneratedType_Renamed_issue_event struct { + Rename map[string]interface{} `json:"rename"` + Url string `json:"url"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. Commit_id string `json:"commit_id"` Event string `json:"event"` Node_id string `json:"node_id"` - Project_card map[string]interface{} `json:"project_card,omitempty"` - Url string `json:"url"` Commit_url string `json:"commit_url"` Created_at string `json:"created_at"` - Performed_via_github_app Integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. +// GeneratedType_Webhook_security_and_analysis represents the GeneratedType_Webhook_security_and_analysis schema from the OpenAPI specification +type GeneratedType_Webhook_security_and_analysis struct { + Changes map[string]interface{} `json:"changes"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Full_repository `json:"repository"` // Full Repository + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Closed_at string `json:"closed_at"` - Commits_url string `json:"commits_url"` - Created_at string `json:"created_at"` - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Html_url string `json:"html_url"` - Milestone GeneratedType `json:"milestone"` // A collection of related issues and pull requests. - Locked bool `json:"locked"` - Review_comments_url string `json:"review_comments_url"` - Base map[string]interface{} `json:"base"` - User GeneratedType `json:"user"` // A GitHub user. - Auto_merge GeneratedType `json:"auto_merge"` // The status of auto merging a pull request. - Merge_commit_sha string `json:"merge_commit_sha"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - State string `json:"state"` - Review_comment_url string `json:"review_comment_url"` - Updated_at string `json:"updated_at"` - Draft bool `json:"draft,omitempty"` // Indicates whether or not the pull request is a draft. - Statuses_url string `json:"statuses_url"` - Links map[string]interface{} `json:"_links"` - Id int64 `json:"id"` - Body string `json:"body"` - Labels []map[string]interface{} `json:"labels"` - Requested_reviewers []GeneratedType `json:"requested_reviewers,omitempty"` - Node_id string `json:"node_id"` - Url string `json:"url"` - Assignees []GeneratedType `json:"assignees,omitempty"` - Diff_url string `json:"diff_url"` - Issue_url string `json:"issue_url"` - Number int `json:"number"` - Requested_teams []Team `json:"requested_teams,omitempty"` - Comments_url string `json:"comments_url"` - Merged_at string `json:"merged_at"` - Active_lock_reason string `json:"active_lock_reason,omitempty"` - Patch_url string `json:"patch_url"` - Head map[string]interface{} `json:"head"` - Title string `json:"title"` +// GeneratedType_Classroom_accepted_assignment represents the GeneratedType_Classroom_accepted_assignment schema from the OpenAPI specification +type GeneratedType_Classroom_accepted_assignment struct { + Repository GeneratedType_Simple_classroom_repository `json:"repository"` // A GitHub repository view for Classroom + Students []GeneratedType_Simple_classroom_user `json:"students"` + Submitted bool `json:"submitted"` // Whether an accepted assignment has been submitted. + Assignment GeneratedType_Simple_classroom_assignment `json:"assignment"` // A GitHub Classroom assignment + Commit_count int `json:"commit_count"` // Count of student commits. + Grade string `json:"grade"` // Most recent grade. + Id int `json:"id"` // Unique identifier of the repository. + Passing bool `json:"passing"` // Whether a submission passed. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alert GeneratedType `json:"alert"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Organization_simple represents the GeneratedType_Organization_simple schema from the OpenAPI specification +type GeneratedType_Organization_simple struct { + Login string `json:"login"` + Hooks_url string `json:"hooks_url"` + Node_id string `json:"node_id"` + Avatar_url string `json:"avatar_url"` + Id int `json:"id"` + Members_url string `json:"members_url"` + Public_members_url string `json:"public_members_url"` + Url string `json:"url"` + Issues_url string `json:"issues_url"` + Repos_url string `json:"repos_url"` + Description string `json:"description"` + Events_url string `json:"events_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` +// GeneratedType_Secret_scanning_location_pull_request_title represents the GeneratedType_Secret_scanning_location_pull_request_title schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_pull_request_title struct { + Pull_request_title_url string `json:"pull_request_title_url"` // The API URL to get the pull request where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Webhook_pull_request_synchronize represents the GeneratedType_Webhook_pull_request_synchronize schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_synchronize struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Number int `json:"number"` // The pull request number. + After string `json:"after"` + Pull_request map[string]interface{} `json:"pull_request"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Before string `json:"before"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. Action string `json:"action"` - Definition map[string]interface{} `json:"definition"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." -} - -// Webhooksworkflowjobrun represents the Webhooksworkflowjobrun schema from the OpenAPI specification -type Webhooksworkflowjobrun struct { - Id int `json:"id"` - Name interface{} `json:"name"` - Status string `json:"status"` - Updated_at string `json:"updated_at"` - Conclusion interface{} `json:"conclusion"` - Created_at string `json:"created_at"` - Environment string `json:"environment"` - Html_url string `json:"html_url"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url"` // The REST API URL of the alert resource. - State string `json:"state"` // State of a code scanning alert. - Number int `json:"number"` // The security alert number. - Instances_url string `json:"instances_url"` // The REST API URL for fetching the list of instances for an alert. - Dismissed_by GeneratedType `json:"dismissed_by"` // A GitHub user. - Tool GeneratedType `json:"tool"` - Rule GeneratedType `json:"rule"` - Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Fixed_at string `json:"fixed_at,omitempty"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Dismissed_comment string `json:"dismissed_comment,omitempty"` // The dismissal comment associated with the dismissal of the alert. - Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Most_recent_instance GeneratedType `json:"most_recent_instance"` - Dismissal_approved_by GeneratedType `json:"dismissal_approved_by,omitempty"` // A GitHub user. - Html_url string `json:"html_url"` // The GitHub URL of the alert resource. - Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Dismissed_reason string `json:"dismissed_reason"` // **Required when the state is dismissed.** The reason for dismissing or closing the alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_View_traffic represents the GeneratedType_View_traffic schema from the OpenAPI specification +type GeneratedType_View_traffic struct { + Count int `json:"count"` + Uniques int `json:"uniques"` + Views []Traffic `json:"views"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Previous_marketplace_purchase map[string]interface{} `json:"previous_marketplace_purchase,omitempty"` - Action string `json:"action"` +// GeneratedType_Webhook_marketplace_purchase_cancelled represents the GeneratedType_Webhook_marketplace_purchase_cancelled schema from the OpenAPI specification +type GeneratedType_Webhook_marketplace_purchase_cancelled struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." Marketplace_purchase Webhooksmarketplacepurchase `json:"marketplace_purchase"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Previous_marketplace_purchase Webhookspreviousmarketplacepurchase `json:"previous_marketplace_purchase,omitempty"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` Effective_date string `json:"effective_date"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - User GeneratedType `json:"user"` // A GitHub user. - Updated_at string `json:"updated_at"` - Html_url string `json:"html_url"` - History []interface{} `json:"history,omitempty"` - Comments_url string `json:"comments_url"` - Git_push_url string `json:"git_push_url"` - Public bool `json:"public"` - Forks_url string `json:"forks_url"` - Comments_enabled bool `json:"comments_enabled,omitempty"` - Node_id string `json:"node_id"` - Owner GeneratedType `json:"owner,omitempty"` // A GitHub user. - Files map[string]interface{} `json:"files"` - Forks []interface{} `json:"forks,omitempty"` - Comments int `json:"comments"` - Description string `json:"description"` - Truncated bool `json:"truncated,omitempty"` - Id string `json:"id"` - Git_pull_url string `json:"git_pull_url"` - Commits_url string `json:"commits_url"` - Created_at string `json:"created_at"` - Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Node_id string `json:"node_id"` - Url string `json:"url"` - Dismissed_review map[string]interface{} `json:"dismissed_review"` - Event string `json:"event"` - Id int `json:"id"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Commit_id string `json:"commit_id"` - Commit_url string `json:"commit_url"` +// GeneratedType_Webhook_secret_scanning_alert_publicly_leaked represents the GeneratedType_Webhook_secret_scanning_alert_publicly_leaked schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_publicly_leaked struct { + Action string `json:"action"` + Alert GeneratedType_Secret_scanning_alert_webhook `json:"alert"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2 GeneratedType `json:"projects_v2"` // A projects v2 project - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Pull_request_review_request represents the GeneratedType_Pull_request_review_request schema from the OpenAPI specification +type GeneratedType_Pull_request_review_request struct { + Teams []Team `json:"teams"` + Users []GeneratedType_Simple_user `json:"users"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_check_suite_requested represents the GeneratedType_Webhook_check_suite_requested schema from the OpenAPI specification +type GeneratedType_Webhook_check_suite_requested struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. + Check_suite map[string]interface{} `json:"check_suite"` // The [check_suite](https://docs.github.com/rest/checks/suites#get-a-check-suite). + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Author map[string]interface{} `json:"author"` // Identifying information for the git-user - Event string `json:"event,omitempty"` - Message string `json:"message"` // Message describing the purpose of the commit - Html_url string `json:"html_url"` - Tree map[string]interface{} `json:"tree"` - Committer map[string]interface{} `json:"committer"` // Identifying information for the git-user - Parents []map[string]interface{} `json:"parents"` - Url string `json:"url"` - Node_id string `json:"node_id"` - Sha string `json:"sha"` // SHA for the commit - Verification map[string]interface{} `json:"verification"` +// GeneratedType_Secret_scanning_location_issue_comment represents the GeneratedType_Secret_scanning_location_issue_comment schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_issue_comment struct { + Issue_comment_url string `json:"issue_comment_url"` // The API URL to get the issue comment where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Field1 int `json:"+1"` - Field1 int `json:"-1"` - Heart int `json:"heart"` - Laugh int `json:"laugh"` - Url string `json:"url"` - Eyes int `json:"eyes"` - Total_count int `json:"total_count"` - Hooray int `json:"hooray"` - Confused int `json:"confused"` - Rocket int `json:"rocket"` +// GeneratedType_Diff_entry represents the GeneratedType_Diff_entry schema from the OpenAPI specification +type GeneratedType_Diff_entry struct { + Patch string `json:"patch,omitempty"` + Blob_url string `json:"blob_url"` + Deletions int `json:"deletions"` + Filename string `json:"filename"` + Raw_url string `json:"raw_url"` + Sha string `json:"sha"` + Additions int `json:"additions"` + Contents_url string `json:"contents_url"` + Previous_filename string `json:"previous_filename,omitempty"` + Status string `json:"status"` + Changes int `json:"changes"` } -// Webhooksissue2 represents the Webhooksissue2 schema from the OpenAPI specification -type Webhooksissue2 struct { - Locked bool `json:"locked,omitempty"` - Performed_via_github_app map[string]interface{} `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Id int64 `json:"id"` - Number int `json:"number"` +// GeneratedType_Code_of_conduct represents the GeneratedType_Code_of_conduct schema from the OpenAPI specification +type GeneratedType_Code_of_conduct struct { + Url string `json:"url"` + Body string `json:"body,omitempty"` Html_url string `json:"html_url"` - Timeline_url string `json:"timeline_url,omitempty"` - Pull_request map[string]interface{} `json:"pull_request,omitempty"` - State string `json:"state,omitempty"` // State of the issue; either 'open' or 'closed' - Updated_at string `json:"updated_at"` - Url string `json:"url"` // URL for the issue - Comments_url string `json:"comments_url"` - Events_url string `json:"events_url"` - Body string `json:"body"` // Contents of the issue - Comments int `json:"comments"` - State_reason string `json:"state_reason,omitempty"` - Created_at string `json:"created_at"` - Repository_url string `json:"repository_url"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Title string `json:"title"` // Title of the issue - Closed_at string `json:"closed_at"` - Assignees []map[string]interface{} `json:"assignees"` - Node_id string `json:"node_id"` - Sub_issues_summary map[string]interface{} `json:"sub_issues_summary,omitempty"` - Active_lock_reason string `json:"active_lock_reason"` - Assignee map[string]interface{} `json:"assignee,omitempty"` - Labels_url string `json:"labels_url"` - Reactions map[string]interface{} `json:"reactions"` - Labels []map[string]interface{} `json:"labels,omitempty"` - Milestone map[string]interface{} `json:"milestone"` // A collection of related issues and pull requests. - TypeField GeneratedType `json:"type,omitempty"` // The type of issue. - User map[string]interface{} `json:"user"` - Draft bool `json:"draft,omitempty"` + Key string `json:"key"` + Name string `json:"name"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow Webhooksworkflow `json:"workflow"` - Workflow_run map[string]interface{} `json:"workflow_run"` - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// Label represents the Label schema from the OpenAPI specification +type Label struct { + Color string `json:"color"` // 6-character hex code, without the leading #, identifying the color + DefaultField bool `json:"default"` // Whether this label comes by default in a new repository. + Description string `json:"description"` // Optional description of the label, such as its purpose. + Id int64 `json:"id"` // Unique identifier for the label. + Name string `json:"name"` // The name of the label. + Node_id string `json:"node_id"` + Url string `json:"url"` // URL for the label } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` +// GeneratedType_Secret_scanning_location_discussion_title represents the GeneratedType_Secret_scanning_location_discussion_title schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location_discussion_title struct { + Discussion_title_url string `json:"discussion_title_url"` // The URL to the discussion where the secret was detected. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - User GeneratedType `json:"user"` // A GitHub user. - State string `json:"state"` // The state of the user's acceptance of the credit. - TypeField string `json:"type"` // The type of credit the user is receiving. +// GeneratedType_Dependency_graph_spdx_sbom represents the GeneratedType_Dependency_graph_spdx_sbom schema from the OpenAPI specification +type GeneratedType_Dependency_graph_spdx_sbom struct { + Sbom map[string]interface{} `json:"sbom"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` - Parameters map[string]interface{} `json:"parameters,omitempty"` +// GeneratedType_Commit_comparison represents the GeneratedType_Commit_comparison schema from the OpenAPI specification +type GeneratedType_Commit_comparison struct { + Patch_url string `json:"patch_url"` + Total_commits int `json:"total_commits"` + Base_commit Commit `json:"base_commit"` // Commit + Behind_by int `json:"behind_by"` + Commits []Commit `json:"commits"` + Files []GeneratedType_Diff_entry `json:"files,omitempty"` + Permalink_url string `json:"permalink_url"` + Status string `json:"status"` + Html_url string `json:"html_url"` + Url string `json:"url"` + Ahead_by int `json:"ahead_by"` + Diff_url string `json:"diff_url"` + Merge_base_commit Commit `json:"merge_base_commit"` // Commit } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Updated_at string `json:"updated_at"` +// GeneratedType_Thread_subscription represents the GeneratedType_Thread_subscription schema from the OpenAPI specification +type GeneratedType_Thread_subscription struct { + Reason string `json:"reason"` + Repository_url string `json:"repository_url,omitempty"` + Subscribed bool `json:"subscribed"` + Thread_url string `json:"thread_url,omitempty"` Url string `json:"url"` - Commit string `json:"commit"` Created_at string `json:"created_at"` - Duration int `json:"duration"` - ErrorField map[string]interface{} `json:"error"` - Pusher GeneratedType `json:"pusher"` // A GitHub user. - Status string `json:"status"` + Ignored bool `json:"ignored"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Account interface{} `json:"account"` - Created_at string `json:"created_at"` - Id int `json:"id"` // Unique identifier of the request installation. +// GeneratedType_Custom_deployment_rule_app represents the GeneratedType_Custom_deployment_rule_app schema from the OpenAPI specification +type GeneratedType_Custom_deployment_rule_app struct { + Node_id string `json:"node_id"` // The node ID for the deployment protection rule integration. + Slug string `json:"slug"` // The slugified name of the deployment protection rule integration. + Id int `json:"id"` // The unique identifier of the deployment protection rule integration. + Integration_url string `json:"integration_url"` // The URL for the endpoint to get details about the app. +} + +// GeneratedType_Simple_check_suite represents the GeneratedType_Simple_check_suite schema from the OpenAPI specification +type GeneratedType_Simple_check_suite struct { + Pull_requests []GeneratedType_Pull_request_minimal `json:"pull_requests,omitempty"` + App Integration `json:"app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Head_sha string `json:"head_sha,omitempty"` // The SHA of the head commit that is being checked. + Repository GeneratedType_Minimal_repository `json:"repository,omitempty"` // Minimal Repository + Before string `json:"before,omitempty"` + Conclusion string `json:"conclusion,omitempty"` + Head_branch string `json:"head_branch,omitempty"` + Id int `json:"id,omitempty"` Node_id string `json:"node_id,omitempty"` - Requester GeneratedType `json:"requester"` // A GitHub user. + Status string `json:"status,omitempty"` + Updated_at string `json:"updated_at,omitempty"` + Url string `json:"url,omitempty"` + After string `json:"after,omitempty"` + Created_at string `json:"created_at,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Starred_at string `json:"starred_at"` // The time the star was created. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Will be `null` for the `deleted` action. +// GeneratedType_File_commit represents the GeneratedType_File_commit schema from the OpenAPI specification +type GeneratedType_File_commit struct { + Content map[string]interface{} `json:"content"` + Commit map[string]interface{} `json:"commit"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_discussion_labeled represents the GeneratedType_Webhook_discussion_labeled schema from the OpenAPI specification +type GeneratedType_Webhook_discussion_labeled struct { Action string `json:"action"` - Comment Webhookscomment `json:"comment"` Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Label Webhookslabel `json:"label"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Location string `json:"location"` - Private_gists int `json:"private_gists"` - Gravatar_id string `json:"gravatar_id"` - Plan map[string]interface{} `json:"plan,omitempty"` - Updated_at string `json:"updated_at"` - Site_admin bool `json:"site_admin"` - Url string `json:"url"` - User_view_type string `json:"user_view_type,omitempty"` - Collaborators int `json:"collaborators"` - Followers int `json:"followers"` - Repos_url string `json:"repos_url"` - Bio string `json:"bio"` - Id int64 `json:"id"` - Hireable bool `json:"hireable"` - Received_events_url string `json:"received_events_url"` - Blog string `json:"blog"` - Followers_url string `json:"followers_url"` - Html_url string `json:"html_url"` - Owned_private_repos int `json:"owned_private_repos"` - Public_repos int `json:"public_repos"` - Gists_url string `json:"gists_url"` - Total_private_repos int `json:"total_private_repos"` - TypeField string `json:"type"` - Notification_email string `json:"notification_email,omitempty"` - Events_url string `json:"events_url"` - Company string `json:"company"` - Business_plus bool `json:"business_plus,omitempty"` - Following_url string `json:"following_url"` - Starred_url string `json:"starred_url"` - Login string `json:"login"` - Created_at string `json:"created_at"` - Name string `json:"name"` - Following int `json:"following"` - Email string `json:"email"` - Two_factor_authentication bool `json:"two_factor_authentication"` - Ldap_dn string `json:"ldap_dn,omitempty"` - Disk_usage int `json:"disk_usage"` - Twitter_username string `json:"twitter_username,omitempty"` - Public_gists int `json:"public_gists"` - Avatar_url string `json:"avatar_url"` - Subscriptions_url string `json:"subscriptions_url"` - Organizations_url string `json:"organizations_url"` - Node_id string `json:"node_id"` +// GeneratedType_Webhook_team_add represents the GeneratedType_Webhook_team_add schema from the OpenAPI specification +type GeneratedType_Webhook_team_add struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Languages_url string `json:"languages_url"` - Deployments_url string `json:"deployments_url"` +// GeneratedType_Content_symlink represents the GeneratedType_Content_symlink schema from the OpenAPI specification +type GeneratedType_Content_symlink struct { Html_url string `json:"html_url"` - Watchers int `json:"watchers"` - Pulls_url string `json:"pulls_url"` - Subscribers_count int `json:"subscribers_count"` - Template_repository GeneratedType `json:"template_repository,omitempty"` // A repository on GitHub. - Subscription_url string `json:"subscription_url"` - Blobs_url string `json:"blobs_url"` - Teams_url string `json:"teams_url"` - Git_tags_url string `json:"git_tags_url"` - Network_count int `json:"network_count"` - Has_projects bool `json:"has_projects"` - Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). - License GeneratedType `json:"license"` // License Simple - Private bool `json:"private"` - Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. - Keys_url string `json:"keys_url"` - Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` - Has_wiki bool `json:"has_wiki"` - Events_url string `json:"events_url"` - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` - Compare_url string `json:"compare_url"` - Forks_url string `json:"forks_url"` - Topics []string `json:"topics,omitempty"` - Owner GeneratedType `json:"owner"` // A GitHub user. - Comments_url string `json:"comments_url"` - Git_commits_url string `json:"git_commits_url"` - Source Repository `json:"source,omitempty"` // A repository on GitHub. - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` - Milestones_url string `json:"milestones_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` - Assignees_url string `json:"assignees_url"` - Contents_url string `json:"contents_url"` - Has_discussions bool `json:"has_discussions"` - Clone_url string `json:"clone_url"` - Hooks_url string `json:"hooks_url"` - Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. - Merges_url string `json:"merges_url"` - Default_branch string `json:"default_branch"` - Description string `json:"description"` - Has_downloads bool `json:"has_downloads,omitempty"` - Issues_url string `json:"issues_url"` - Allow_forking bool `json:"allow_forking,omitempty"` - Created_at string `json:"created_at"` - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` + Sha string `json:"sha"` + Target string `json:"target"` + Download_url string `json:"download_url"` + Path string `json:"path"` + Size int `json:"size"` + TypeField string `json:"type"` Url string `json:"url"` - Contributors_url string `json:"contributors_url"` - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. - Has_pages bool `json:"has_pages"` - Archive_url string `json:"archive_url"` - Tags_url string `json:"tags_url"` - Allow_update_branch bool `json:"allow_update_branch,omitempty"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub user. - Svn_url string `json:"svn_url"` - Watchers_count int `json:"watchers_count"` - Issue_events_url string `json:"issue_events_url"` - Collaborators_url string `json:"collaborators_url"` - Open_issues int `json:"open_issues"` - Statuses_url string `json:"statuses_url"` - Open_issues_count int `json:"open_issues_count"` - Notifications_url string `json:"notifications_url"` - Subscribers_url string `json:"subscribers_url"` - Master_branch string `json:"master_branch,omitempty"` - Updated_at string `json:"updated_at"` - Name string `json:"name"` - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Releases_url string `json:"releases_url"` - Stargazers_count int `json:"stargazers_count"` - Permissions map[string]interface{} `json:"permissions,omitempty"` - Mirror_url string `json:"mirror_url"` - Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is allowed. - Forks_count int `json:"forks_count"` - Git_refs_url string `json:"git_refs_url"` - Security_and_analysis GeneratedType `json:"security_and_analysis,omitempty"` - Id int64 `json:"id"` - Fork bool `json:"fork"` - Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Issue_comment_url string `json:"issue_comment_url"` - Trees_url string `json:"trees_url"` - Commits_url string `json:"commits_url"` - Parent Repository `json:"parent,omitempty"` // A repository on GitHub. - Archived bool `json:"archived"` - Branches_url string `json:"branches_url"` - Forks int `json:"forks"` - Stargazers_url string `json:"stargazers_url"` - Is_template bool `json:"is_template,omitempty"` - Has_issues bool `json:"has_issues"` - Homepage string `json:"homepage"` - Labels_url string `json:"labels_url"` - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. Git_url string `json:"git_url"` - Ssh_url string `json:"ssh_url"` - Node_id string `json:"node_id"` - Pushed_at string `json:"pushed_at"` - Full_name string `json:"full_name"` - Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). - Language string `json:"language"` - Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. - Code_of_conduct GeneratedType `json:"code_of_conduct,omitempty"` // Code of Conduct Simple - Downloads_url string `json:"downloads_url"` - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` + Name string `json:"name"` + Links map[string]interface{} `json:"_links"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Comment string `json:"comment,omitempty"` // Optional comment to include with the review. - Environment_name string `json:"environment_name"` // The name of the environment to approve or reject. - State string `json:"state"` // Whether to approve or reject deployment to the specified environments. +// GeneratedType_Nullable_scoped_installation represents the GeneratedType_Nullable_scoped_installation schema from the OpenAPI specification +type GeneratedType_Nullable_scoped_installation struct { + Permissions GeneratedType_App_permissions `json:"permissions"` // The permissions granted to the user access token. + Repositories_url string `json:"repositories_url"` + Repository_selection string `json:"repository_selection"` // Describe whether all repositories have been selected or there's a selection involved + Single_file_name string `json:"single_file_name"` + Single_file_paths []string `json:"single_file_paths,omitempty"` + Account GeneratedType_Simple_user `json:"account"` // A GitHub user. + Has_multiple_single_files bool `json:"has_multiple_single_files,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Id int `json:"id"` - Url string `json:"url"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Created_at string `json:"created_at"` - Event string `json:"event"` - Node_id string `json:"node_id"` - Commit_id string `json:"commit_id"` - Commit_url string `json:"commit_url"` - Lock_reason string `json:"lock_reason"` +// GeneratedType_Code_scanning_analysis_tool represents the GeneratedType_Code_scanning_analysis_tool schema from the OpenAPI specification +type GeneratedType_Code_scanning_analysis_tool struct { + Name string `json:"name,omitempty"` // The name of the tool used to generate the code scanning analysis. + Version string `json:"version,omitempty"` // The version of the tool used to generate the code scanning analysis. + Guid string `json:"guid,omitempty"` // The GUID of the tool used to generate the code scanning analysis, if provided in the uploaded SARIF data. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Description string `json:"description"` +// GeneratedType_Short_branch represents the GeneratedType_Short_branch schema from the OpenAPI specification +type GeneratedType_Short_branch struct { + Commit map[string]interface{} `json:"commit"` Name string `json:"name"` - Text_matches []map[string]interface{} `json:"text_matches,omitempty"` - Node_id string `json:"node_id"` - Color string `json:"color"` - DefaultField bool `json:"default"` - Id int `json:"id"` - Score float64 `json:"score"` - Url string `json:"url"` + Protected bool `json:"protected"` + Protection GeneratedType_Branch_protection `json:"protection,omitempty"` // Branch Protection + Protection_url string `json:"protection_url,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Teams_url string `json:"teams_url"` // The API URL to list the teams on the repository. - Contents_url string `json:"contents_url"` // A template for the API URL to get the contents of the repository. - Assignees_url string `json:"assignees_url"` // A template for the API URL to list the available assignees for issues in the repository. - Branches_url string `json:"branches_url"` // A template for the API URL to get information about branches in the repository. - Commits_url string `json:"commits_url"` // A template for the API URL to get information about commits on the repository. - Events_url string `json:"events_url"` // The API URL to list the events of the repository. - Git_commits_url string `json:"git_commits_url"` // A template for the API URL to get information about Git commits of the repository. - Name string `json:"name"` // The name of the repository. - Keys_url string `json:"keys_url"` // A template for the API URL to get information about deploy keys on the repository. - Issue_events_url string `json:"issue_events_url"` // A template for the API URL to get information about issue events on the repository. - Private bool `json:"private"` // Whether the repository is private. - Contributors_url string `json:"contributors_url"` // A template for the API URL to list the contributors to the repository. - Tags_url string `json:"tags_url"` // The API URL to get information about tags on the repository. - Blobs_url string `json:"blobs_url"` // A template for the API URL to create or retrieve a raw Git blob in the repository. - Subscription_url string `json:"subscription_url"` // The API URL to subscribe to notifications for this repository. - Description string `json:"description"` // The repository description. - Issues_url string `json:"issues_url"` // A template for the API URL to get information about issues on the repository. - Notifications_url string `json:"notifications_url"` // A template for the API URL to get information about notifications on the repository. - Deployments_url string `json:"deployments_url"` // The API URL to list the deployments of the repository. - Forks_url string `json:"forks_url"` // The API URL to list the forks of the repository. - Labels_url string `json:"labels_url"` // A template for the API URL to get information about labels of the repository. - Archive_url string `json:"archive_url"` // A template for the API URL to download the repository as an archive. - Collaborators_url string `json:"collaborators_url"` // A template for the API URL to get information about collaborators of the repository. - Owner GeneratedType `json:"owner"` // A GitHub user. - Downloads_url string `json:"downloads_url"` // The API URL to list the downloads on the repository. - Merges_url string `json:"merges_url"` // The API URL to merge branches in the repository. - Stargazers_url string `json:"stargazers_url"` // The API URL to list the stargazers on the repository. - Comments_url string `json:"comments_url"` // A template for the API URL to get information about comments on the repository. - Issue_comment_url string `json:"issue_comment_url"` // A template for the API URL to get information about issue comments on the repository. - Node_id string `json:"node_id"` // The GraphQL identifier of the repository. - Fork bool `json:"fork"` // Whether the repository is a fork. - Milestones_url string `json:"milestones_url"` // A template for the API URL to get information about milestones of the repository. - Git_refs_url string `json:"git_refs_url"` // A template for the API URL to get information about Git refs of the repository. - Subscribers_url string `json:"subscribers_url"` // The API URL to list the subscribers on the repository. - Hooks_url string `json:"hooks_url"` // The API URL to list the hooks on the repository. - Statuses_url string `json:"statuses_url"` // A template for the API URL to get information about statuses of a commit. - Html_url string `json:"html_url"` // The URL to view the repository on GitHub.com. - Id int64 `json:"id"` // A unique identifier of the repository. - Compare_url string `json:"compare_url"` // A template for the API URL to compare two commits or refs. - Languages_url string `json:"languages_url"` // The API URL to get information about the languages of the repository. - Url string `json:"url"` // The URL to get more information about the repository from the GitHub API. - Pulls_url string `json:"pulls_url"` // A template for the API URL to get information about pull requests on the repository. - Full_name string `json:"full_name"` // The full, globally unique, name of the repository. - Releases_url string `json:"releases_url"` // A template for the API URL to get information about releases on the repository. - Git_tags_url string `json:"git_tags_url"` // A template for the API URL to get information about Git tags of the repository. - Trees_url string `json:"trees_url"` // A template for the API URL to create or retrieve a raw Git tree of the repository. +// GeneratedType_Webhook_membership_removed represents the GeneratedType_Webhook_membership_removed schema from the OpenAPI specification +type GeneratedType_Webhook_membership_removed struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Member Webhooksuser `json:"member"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Team Webhooksteam `json:"team"` // Groups of organization members that gives permissions on specified repositories. + Scope string `json:"scope"` // The scope of the membership. Currently, can only be `team`. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sender map[string]interface{} `json:"sender"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_push represents the GeneratedType_Webhook_push schema from the OpenAPI specification +type GeneratedType_Webhook_push struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Ref string `json:"ref"` // The full git ref that was pushed. Example: `refs/heads/main` or `refs/tags/v3.14.1`. + After string `json:"after"` // The SHA of the most recent commit on `ref` after the push. + Head_commit map[string]interface{} `json:"head_commit"` + Compare string `json:"compare"` // URL that shows the changes in this `ref` update, from the `before` commit to the `after` commit. For a newly created `ref` that is directly based on the default branch, this is the comparison between the head of the default branch and the `after` commit. Otherwise, this shows all commits until the `after` commit. + Before string `json:"before"` // The SHA of the most recent commit on `ref` before the push. + Pusher map[string]interface{} `json:"pusher"` // Metaproperties for Git author/committer information. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Commits []map[string]interface{} `json:"commits"` // An array of commit objects describing the pushed commits. (Pushed commits are all commits that are included in the `compare` between the `before` commit and the `after` commit.) The array includes a maximum of 2048 commits. If necessary, you can use the [Commits API](https://docs.github.com/rest/commits) to fetch additional commits. + Deleted bool `json:"deleted"` // Whether this push deleted the `ref`. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository map[string]interface{} `json:"repository"` // A git repository + Base_ref string `json:"base_ref"` + Created bool `json:"created"` // Whether this push created the `ref`. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Forced bool `json:"forced"` // Whether this push was a force push of the `ref`. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Source string `json:"source"` // The image provider. - Display_name string `json:"display_name"` // Display name for this image. - Id string `json:"id"` // The ID of the image. Use this ID for the `image` parameter when creating a new larger runner. - Size_gb int `json:"size_gb"` // Image size in GB. +// GeneratedType_Pull_request_review represents the GeneratedType_Pull_request_review schema from the OpenAPI specification +type GeneratedType_Pull_request_review struct { + Author_association string `json:"author_association"` // How the author is associated with the repository. + Commit_id string `json:"commit_id"` // A commit SHA for the review. If the commit object was garbage collected or forcibly deleted, then it no longer exists in Git and this value will be `null`. + Body string `json:"body"` // The text of the review. + Body_html string `json:"body_html,omitempty"` + Id int64 `json:"id"` // Unique identifier of the review + Pull_request_url string `json:"pull_request_url"` + Submitted_at string `json:"submitted_at,omitempty"` + Body_text string `json:"body_text,omitempty"` + User GeneratedType_Nullable_simple_user `json:"user"` // A GitHub user. + Html_url string `json:"html_url"` + Node_id string `json:"node_id"` + State string `json:"state"` + Links map[string]interface{} `json:"_links"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Branches_url string `json:"branches_url"` - Updated_at string `json:"updated_at"` - Has_issues bool `json:"has_issues"` // Whether issues are enabled. - Mirror_url string `json:"mirror_url"` - Issue_comment_url string `json:"issue_comment_url"` - Commits_url string `json:"commits_url"` - Downloads_url string `json:"downloads_url"` - Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo - Notifications_url string `json:"notifications_url"` - Squash_merge_commit_title string `json:"squash_merge_commit_title,omitempty"` // The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit). - Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. +// GeneratedType_Nullable_minimal_repository represents the GeneratedType_Nullable_minimal_repository schema from the OpenAPI specification +type GeneratedType_Nullable_minimal_repository struct { + Private bool `json:"private"` + Language string `json:"language,omitempty"` Deployments_url string `json:"deployments_url"` - Forks_count int `json:"forks_count"` - Html_url string `json:"html_url"` - Releases_url string `json:"releases_url"` - Events_url string `json:"events_url"` - Issue_events_url string `json:"issue_events_url"` - Watchers int `json:"watchers"` + Languages_url string `json:"languages_url"` + Svn_url string `json:"svn_url,omitempty"` + Mirror_url string `json:"mirror_url,omitempty"` + Notifications_url string `json:"notifications_url"` Fork bool `json:"fork"` - Forks_url string `json:"forks_url"` - Default_branch string `json:"default_branch"` // The default branch of the repository. - Keys_url string `json:"keys_url"` - Subscribers_count int `json:"subscribers_count,omitempty"` - Blobs_url string `json:"blobs_url"` - Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. + Full_name string `json:"full_name"` Permissions map[string]interface{} `json:"permissions,omitempty"` - Anonymous_access_enabled bool `json:"anonymous_access_enabled,omitempty"` // Whether anonymous git access is enabled for this repository - Organization GeneratedType `json:"organization,omitempty"` // A GitHub user. - Stargazers_url string `json:"stargazers_url"` - Compare_url string `json:"compare_url"` - Url string `json:"url"` - Languages_url string `json:"languages_url"` - Created_at string `json:"created_at"` - Comments_url string `json:"comments_url"` - Teams_url string `json:"teams_url"` - License GeneratedType `json:"license"` // License Simple - Ssh_url string `json:"ssh_url"` - Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. - Tags_url string `json:"tags_url"` - Archived bool `json:"archived"` // Whether the repository is archived. - Squash_merge_commit_message string `json:"squash_merge_commit_message,omitempty"` // The default value for a squash merge commit message: - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message. - Homepage string `json:"homepage"` - Size int `json:"size"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. - Master_branch string `json:"master_branch,omitempty"` + Open_issues int `json:"open_issues,omitempty"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` + Merges_url string `json:"merges_url"` + Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. Assignees_url string `json:"assignees_url"` Hooks_url string `json:"hooks_url"` - Open_issues_count int `json:"open_issues_count"` - Stargazers_count int `json:"stargazers_count"` - Forks int `json:"forks"` - Private bool `json:"private"` // Whether the repository is private or public. - Temp_clone_token string `json:"temp_clone_token,omitempty"` - Full_name string `json:"full_name"` - Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. - Description string `json:"description"` - Template_repository map[string]interface{} `json:"template_repository,omitempty"` - Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged - Archive_url string `json:"archive_url"` - Svn_url string `json:"svn_url"` - Use_squash_pr_title_as_default bool `json:"use_squash_pr_title_as_default,omitempty"` // Whether a squash merge commit can use the pull request title as default. **This property is closing down. Please use `squash_merge_commit_title` instead. - Merge_commit_title string `json:"merge_commit_title,omitempty"` // The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name). - Clone_url string `json:"clone_url"` + Updated_at string `json:"updated_at,omitempty"` + Url string `json:"url"` + Git_commits_url string `json:"git_commits_url"` Trees_url string `json:"trees_url"` + Comments_url string `json:"comments_url"` + Open_issues_count int `json:"open_issues_count,omitempty"` + Events_url string `json:"events_url"` + Forks_url string `json:"forks_url"` + Git_url string `json:"git_url,omitempty"` + Network_count int `json:"network_count,omitempty"` Contents_url string `json:"contents_url"` - Open_issues int `json:"open_issues"` - Watchers_count int `json:"watchers_count"` - Has_projects bool `json:"has_projects"` // Whether projects are enabled. - Owner GeneratedType `json:"owner"` // A GitHub user. - Id int64 `json:"id"` // Unique identifier of the repository + Allow_forking bool `json:"allow_forking,omitempty"` + Visibility string `json:"visibility,omitempty"` + Stargazers_count int `json:"stargazers_count,omitempty"` + Contributors_url string `json:"contributors_url"` + Watchers int `json:"watchers,omitempty"` + Default_branch string `json:"default_branch,omitempty"` + Issue_events_url string `json:"issue_events_url"` + Size int `json:"size,omitempty"` // The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0. + Watchers_count int `json:"watchers_count,omitempty"` + Homepage string `json:"homepage,omitempty"` + Clone_url string `json:"clone_url,omitempty"` + Has_downloads bool `json:"has_downloads,omitempty"` + Archive_url string `json:"archive_url"` + Archived bool `json:"archived,omitempty"` + Has_discussions bool `json:"has_discussions,omitempty"` + Has_issues bool `json:"has_issues,omitempty"` + Is_template bool `json:"is_template,omitempty"` Subscribers_url string `json:"subscribers_url"` - Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. - Has_pages bool `json:"has_pages"` - Merges_url string `json:"merges_url"` - Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. - Topics []string `json:"topics,omitempty"` - Git_commits_url string `json:"git_commits_url"` - Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. - Labels_url string `json:"labels_url"` - Network_count int `json:"network_count,omitempty"` - Subscription_url string `json:"subscription_url"` - Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. - Starred_at string `json:"starred_at,omitempty"` - Git_refs_url string `json:"git_refs_url"` - Has_discussions bool `json:"has_discussions,omitempty"` // Whether discussions are enabled. + Pushed_at string `json:"pushed_at,omitempty"` + Blobs_url string `json:"blobs_url"` + Forks int `json:"forks,omitempty"` + Description string `json:"description"` + Releases_url string `json:"releases_url"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Issues_url string `json:"issues_url"` + Has_pages bool `json:"has_pages,omitempty"` + License map[string]interface{} `json:"license,omitempty"` Statuses_url string `json:"statuses_url"` + Labels_url string `json:"labels_url"` + Commits_url string `json:"commits_url"` + Html_url string `json:"html_url"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` Git_tags_url string `json:"git_tags_url"` - Contributors_url string `json:"contributors_url"` - Collaborators_url string `json:"collaborators_url"` - Allow_update_branch bool `json:"allow_update_branch,omitempty"` // Whether or not a pull request head branch that is behind its base branch can always be updated even if it is not required to be up to date before merging. - Name string `json:"name"` // The name of the repository. - Pushed_at string `json:"pushed_at"` - Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. - Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + Tags_url string `json:"tags_url"` + Subscription_url string `json:"subscription_url"` + Teams_url string `json:"teams_url"` + Disabled bool `json:"disabled,omitempty"` Pulls_url string `json:"pulls_url"` - Custom_properties map[string]interface{} `json:"custom_properties,omitempty"` // The custom properties that were defined for the repository. The keys are the custom property names, and the values are the corresponding custom property values. + Git_refs_url string `json:"git_refs_url"` + Topics []string `json:"topics,omitempty"` + Has_wiki bool `json:"has_wiki,omitempty"` + Downloads_url string `json:"downloads_url"` + Name string `json:"name"` Milestones_url string `json:"milestones_url"` - Merge_commit_message string `json:"merge_commit_message,omitempty"` // The default value for a merge commit message. - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message. - Language string `json:"language"` - Issues_url string `json:"issues_url"` - Git_url string `json:"git_url"` + Has_projects bool `json:"has_projects,omitempty"` + Ssh_url string `json:"ssh_url,omitempty"` + Branches_url string `json:"branches_url"` + Role_name string `json:"role_name,omitempty"` Node_id string `json:"node_id"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Updated_at string `json:"updated_at,omitempty"` + Owner GeneratedType_Simple_user `json:"owner"` // A GitHub user. + Issue_comment_url string `json:"issue_comment_url"` + Compare_url string `json:"compare_url"` + Collaborators_url string `json:"collaborators_url"` + Security_and_analysis GeneratedType_Security_and_analysis `json:"security_and_analysis,omitempty"` + Id int64 `json:"id"` + Forks_count int `json:"forks_count,omitempty"` + Keys_url string `json:"keys_url"` + Stargazers_url string `json:"stargazers_url"` + Subscribers_count int `json:"subscribers_count,omitempty"` Created_at string `json:"created_at,omitempty"` - Enabled bool `json:"enabled,omitempty"` - Id int `json:"id,omitempty"` - Pattern string `json:"pattern"` + Code_of_conduct GeneratedType_Code_of_conduct `json:"code_of_conduct,omitempty"` // Code Of Conduct } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Number int `json:"number"` // The pull request number. - Pull_request GeneratedType `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` // The changes to the comment if the action was `edited`. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// Webhooksapprover represents the Webhooksapprover schema from the OpenAPI specification +type Webhooksapprover struct { + Starred_url string `json:"starred_url,omitempty"` + User_view_type string `json:"user_view_type,omitempty"` + Events_url string `json:"events_url,omitempty"` + Site_admin bool `json:"site_admin,omitempty"` + Subscriptions_url string `json:"subscriptions_url,omitempty"` + Url string `json:"url,omitempty"` + Repos_url string `json:"repos_url,omitempty"` + Id int `json:"id,omitempty"` + TypeField string `json:"type,omitempty"` + Node_id string `json:"node_id,omitempty"` + Login string `json:"login,omitempty"` + Html_url string `json:"html_url,omitempty"` + Followers_url string `json:"followers_url,omitempty"` + Following_url string `json:"following_url,omitempty"` + Gists_url string `json:"gists_url,omitempty"` + Gravatar_id string `json:"gravatar_id,omitempty"` + Organizations_url string `json:"organizations_url,omitempty"` + Avatar_url string `json:"avatar_url,omitempty"` + Received_events_url string `json:"received_events_url,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Releases_url string `json:"releases_url"` // A template for the API URL to get information about releases on the repository. - Fork bool `json:"fork"` // Whether the repository is a fork. - Url string `json:"url"` // The URL to get more information about the repository from the GitHub API. - Issue_comment_url string `json:"issue_comment_url"` // A template for the API URL to get information about issue comments on the repository. - Blobs_url string `json:"blobs_url"` // A template for the API URL to create or retrieve a raw Git blob in the repository. - Description string `json:"description"` // The repository description. - Keys_url string `json:"keys_url"` // A template for the API URL to get information about deploy keys on the repository. - Stargazers_url string `json:"stargazers_url"` // The API URL to list the stargazers on the repository. - Subscribers_url string `json:"subscribers_url"` // The API URL to list the subscribers on the repository. - Full_name string `json:"full_name"` // The full, globally unique, name of the repository. - Languages_url string `json:"languages_url"` // The API URL to get information about the languages of the repository. - Hooks_url string `json:"hooks_url"` // The API URL to list the hooks on the repository. - Owner GeneratedType `json:"owner"` // A GitHub user. - Downloads_url string `json:"downloads_url"` // The API URL to list the downloads on the repository. - Compare_url string `json:"compare_url"` // A template for the API URL to compare two commits or refs. - Tags_url string `json:"tags_url"` // The API URL to get information about tags on the repository. - Forks_url string `json:"forks_url"` // The API URL to list the forks of the repository. - Id int64 `json:"id"` // A unique identifier of the repository. - Branches_url string `json:"branches_url"` // A template for the API URL to get information about branches in the repository. - Commits_url string `json:"commits_url"` // A template for the API URL to get information about commits on the repository. - Labels_url string `json:"labels_url"` // A template for the API URL to get information about labels of the repository. - Deployments_url string `json:"deployments_url"` // The API URL to list the deployments of the repository. - Collaborators_url string `json:"collaborators_url"` // A template for the API URL to get information about collaborators of the repository. - Milestones_url string `json:"milestones_url"` // A template for the API URL to get information about milestones of the repository. - Issue_events_url string `json:"issue_events_url"` // A template for the API URL to get information about issue events on the repository. - Issues_url string `json:"issues_url"` // A template for the API URL to get information about issues on the repository. - Merges_url string `json:"merges_url"` // The API URL to merge branches in the repository. - Archive_url string `json:"archive_url"` // A template for the API URL to download the repository as an archive. - Events_url string `json:"events_url"` // The API URL to list the events of the repository. - Notifications_url string `json:"notifications_url"` // A template for the API URL to get information about notifications on the repository. - Git_commits_url string `json:"git_commits_url"` // A template for the API URL to get information about Git commits of the repository. - Private bool `json:"private"` // Whether the repository is private. - Subscription_url string `json:"subscription_url"` // The API URL to subscribe to notifications for this repository. - Html_url string `json:"html_url"` // The URL to view the repository on GitHub.com. - Statuses_url string `json:"statuses_url"` // A template for the API URL to get information about statuses of a commit. - Contents_url string `json:"contents_url"` // A template for the API URL to get the contents of the repository. - Name string `json:"name"` // The name of the repository. - Teams_url string `json:"teams_url"` // The API URL to list the teams on the repository. - Contributors_url string `json:"contributors_url"` // A template for the API URL to list the contributors to the repository. - Git_refs_url string `json:"git_refs_url"` // A template for the API URL to get information about Git refs of the repository. - Trees_url string `json:"trees_url"` // A template for the API URL to create or retrieve a raw Git tree of the repository. - Pulls_url string `json:"pulls_url"` // A template for the API URL to get information about pull requests on the repository. - Node_id string `json:"node_id"` // The GraphQL identifier of the repository. - Assignees_url string `json:"assignees_url"` // A template for the API URL to list the available assignees for issues in the repository. - Comments_url string `json:"comments_url"` // A template for the API URL to get information about comments on the repository. - Git_tags_url string `json:"git_tags_url"` // A template for the API URL to get information about Git tags of the repository. +// GeneratedType_Organization_create_issue_type represents the GeneratedType_Organization_create_issue_type schema from the OpenAPI specification +type GeneratedType_Organization_create_issue_type struct { + Description string `json:"description,omitempty"` // Description of the issue type. + Is_enabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. + Name string `json:"name"` // Name of the issue type. + Color string `json:"color,omitempty"` // Color for the issue type. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Custom_pattern_name string `json:"custom_pattern_name,omitempty"` // If the scan was triggered by a custom pattern update, this will be the name of the pattern that was updated - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Completed_at string `json:"completed_at"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Custom_pattern_scope string `json:"custom_pattern_scope,omitempty"` // If the scan was triggered by a custom pattern update, this will be the scope of the pattern that was updated - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Started_at string `json:"started_at"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. +// GeneratedType_Webhook_team_added_to_repository represents the GeneratedType_Webhook_team_added_to_repository schema from the OpenAPI specification +type GeneratedType_Webhook_team_added_to_repository struct { + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Team Webhooksteam1 `json:"team"` // Groups of organization members that gives permissions on specified repositories. Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. - Secret_types []string `json:"secret_types,omitempty"` // List of patterns that were updated. This will be empty for normal backfill scans or custom pattern updates - Source string `json:"source"` // What type of content was scanned - TypeField string `json:"type"` // What type of scan was completed + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository map[string]interface{} `json:"repository,omitempty"` // A git repository } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Assigning_team interface{} `json:"assigning_team,omitempty"` // The team through which the assignee is granted access to GitHub Copilot, if applicable. - Last_activity_at string `json:"last_activity_at,omitempty"` // Timestamp of user's last GitHub Copilot activity, in ISO 8601 format. - Updated_at string `json:"updated_at,omitempty"` // **Closing down notice:** This field is no longer relevant and is closing down. Use the `created_at` field to determine when the assignee was last granted access to GitHub Copilot. Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. - Pending_cancellation_date string `json:"pending_cancellation_date,omitempty"` // The pending cancellation date for the seat, in `YYYY-MM-DD` format. This will be null unless the assignee's Copilot access has been canceled during the current billing cycle. If the seat has been cancelled, this corresponds to the start of the organization's next billing cycle. - Assignee GeneratedType `json:"assignee,omitempty"` // A GitHub user. - Last_activity_editor string `json:"last_activity_editor,omitempty"` // Last editor that was used by the user for a GitHub Copilot completion. - Created_at string `json:"created_at"` // Timestamp of when the assignee was last granted access to GitHub Copilot, in ISO 8601 format. - Plan_type string `json:"plan_type,omitempty"` // The Copilot plan of the organization, or the parent enterprise, when applicable. +// GeneratedType_Simple_classroom_assignment represents the GeneratedType_Simple_classroom_assignment schema from the OpenAPI specification +type GeneratedType_Simple_classroom_assignment struct { + Public_repo bool `json:"public_repo"` // Whether an accepted assignment creates a public repository. + Students_are_repo_admins bool `json:"students_are_repo_admins"` // Whether students are admins on created repository on accepted assignment. + Feedback_pull_requests_enabled bool `json:"feedback_pull_requests_enabled"` // Whether feedback pull request will be created on assignment acceptance. + Title string `json:"title"` // Assignment title. + TypeField string `json:"type"` // Whether it's a Group Assignment or Individual Assignment. + Language string `json:"language"` // The programming language used in the assignment. + Invitations_enabled bool `json:"invitations_enabled"` // Whether the invitation link is enabled. Visiting an enabled invitation link will accept the assignment. + Classroom GeneratedType_Simple_classroom `json:"classroom"` // A GitHub Classroom classroom + Slug string `json:"slug"` // Sluggified name of the assignment. + Max_teams int `json:"max_teams,omitempty"` // The maximum allowable teams for the assignment. + Editor string `json:"editor"` // The selected editor for the assignment. + Passing int `json:"passing"` // The number of students that have passed the assignment. + Submitted int `json:"submitted"` // The number of students that have submitted the assignment. + Invite_link string `json:"invite_link"` // The link that a student can use to accept the assignment. + Deadline string `json:"deadline"` // The time at which the assignment is due. + Id int `json:"id"` // Unique identifier of the repository. + Accepted int `json:"accepted"` // The number of students that have accepted the assignment. + Max_members int `json:"max_members,omitempty"` // The maximum allowable members per team. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the secret. - Updated_at string `json:"updated_at"` - Created_at string `json:"created_at"` +// GeneratedType_Webhook_deployment_protection_rule_requested represents the GeneratedType_Webhook_deployment_protection_rule_requested schema from the OpenAPI specification +type GeneratedType_Webhook_deployment_protection_rule_requested struct { + Deployment_callback_url string `json:"deployment_callback_url,omitempty"` // The URL to review the deployment protection rule. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Pull_requests []GeneratedType_Pull_request `json:"pull_requests,omitempty"` + Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed + Environment string `json:"environment,omitempty"` // The name of the environment that has the deployment protection rule. + Event string `json:"event,omitempty"` // The event that triggered the deployment protection rule. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Sponsorship Webhookssponsorship `json:"sponsorship"` +// GeneratedType_Webhook_projects_v2_status_update_created represents the GeneratedType_Webhook_projects_v2_status_update_created schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_status_update_created struct { Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` // The action that was performed. - Assignee Webhooksuser `json:"assignee,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_status_update GeneratedType_Projects_v2_status_update `json:"projects_v2_status_update"` // An status update belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Bypass_mode string `json:"bypass_mode,omitempty"` // When the specified actor can bypass the ruleset. `pull_request` means that an actor can only bypass rules on pull requests. `pull_request` is not applicable for the `DeployKey` actor type. Also, `pull_request` is only applicable to branch rulesets. - Actor_id int `json:"actor_id,omitempty"` // The ID of the actor that can bypass a ruleset. If `actor_type` is `OrganizationAdmin`, this should be `1`. If `actor_type` is `DeployKey`, this should be null. `OrganizationAdmin` is not applicable for personal repositories. - Actor_type string `json:"actor_type"` // The type of actor that can bypass a ruleset. +// GeneratedType_Code_scanning_variant_analysis_skipped_repo_group represents the GeneratedType_Code_scanning_variant_analysis_skipped_repo_group schema from the OpenAPI specification +type GeneratedType_Code_scanning_variant_analysis_skipped_repo_group struct { + Repository_count int `json:"repository_count"` // The total number of repositories that were skipped for this reason. + Repositories []GeneratedType_Code_scanning_variant_analysis_repository `json:"repositories"` // A list of repositories that were skipped. This list may not include all repositories that were skipped. This is only available when the repository was found and the user has access to it. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repositories []GeneratedType `json:"repositories"` // A list of repositories that were skipped. This list may not include all repositories that were skipped. This is only available when the repository was found and the user has access to it. - Repository_count int `json:"repository_count"` // The total number of repositories that were skipped for this reason. +// Webhooksrelease1 represents the Webhooksrelease1 schema from the OpenAPI specification +type Webhooksrelease1 struct { + Author map[string]interface{} `json:"author"` + Target_commitish string `json:"target_commitish"` // Specifies the commitish value that determines where the Git tag is created from. + Url string `json:"url"` + Html_url string `json:"html_url"` + Created_at string `json:"created_at"` + Id int `json:"id"` + Assets_url string `json:"assets_url"` + Tag_name string `json:"tag_name"` // The name of the tag. + Tarball_url string `json:"tarball_url"` + Node_id string `json:"node_id"` + Body string `json:"body"` + Zipball_url string `json:"zipball_url"` + Draft bool `json:"draft"` // Whether the release is a draft or published + Published_at string `json:"published_at"` + Assets []map[string]interface{} `json:"assets"` + Discussion_url string `json:"discussion_url,omitempty"` + Reactions map[string]interface{} `json:"reactions,omitempty"` + Upload_url string `json:"upload_url"` + Name string `json:"name"` + Prerelease bool `json:"prerelease"` // Whether the release is identified as a prerelease or a full release. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_issue_comment_edited represents the GeneratedType_Webhook_issue_comment_edited schema from the OpenAPI specification +type GeneratedType_Webhook_issue_comment_edited struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Changes Webhookschanges `json:"changes"` // The changes to the comment. + Comment Webhooksissuecomment `json:"comment"` // The [comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment) itself. + Issue interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) the comment belongs to. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Billing_cycle string `json:"billing_cycle"` - Free_trial_ends_on string `json:"free_trial_ends_on"` - Next_billing_date string `json:"next_billing_date"` - On_free_trial bool `json:"on_free_trial"` - Plan GeneratedType `json:"plan"` // Marketplace Listing Plan - Unit_count int `json:"unit_count"` - Updated_at string `json:"updated_at"` - Account GeneratedType `json:"account"` +// GeneratedType_Webhook_release_deleted represents the GeneratedType_Webhook_release_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_release_deleted struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Release Webhooksrelease `json:"release"` // The [release](https://docs.github.com/rest/releases/releases/#get-a-release) object. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_secret_scanning_alert_reopened represents the GeneratedType_Webhook_secret_scanning_alert_reopened schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_reopened struct { Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Number int `json:"number"` // The pull request number. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Pull_request GeneratedType `json:"pull_request"` - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. + Alert GeneratedType_Secret_scanning_alert_webhook `json:"alert"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Alt_domain map[string]interface{} `json:"alt_domain,omitempty"` - Domain map[string]interface{} `json:"domain,omitempty"` +// GeneratedType_Organization_invitation represents the GeneratedType_Organization_invitation schema from the OpenAPI specification +type GeneratedType_Organization_invitation struct { + Team_count int `json:"team_count"` + Failed_at string `json:"failed_at,omitempty"` + Failed_reason string `json:"failed_reason,omitempty"` + Id int64 `json:"id"` + Role string `json:"role"` + Invitation_teams_url string `json:"invitation_teams_url"` + Node_id string `json:"node_id"` + Login string `json:"login"` + Created_at string `json:"created_at"` + Email string `json:"email"` + Invitation_source string `json:"invitation_source,omitempty"` + Inviter GeneratedType_Simple_user `json:"inviter"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Event string `json:"event,omitempty"` - Node_id string `json:"node_id,omitempty"` - Comments []GeneratedType `json:"comments,omitempty"` - Commit_id string `json:"commit_id,omitempty"` +// Dependency represents the Dependency schema from the OpenAPI specification +type Dependency struct { + Dependencies []string `json:"dependencies,omitempty"` // Array of package-url (PURLs) of direct child dependencies. + Metadata Metadata `json:"metadata,omitempty"` // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. + Package_url string `json:"package_url,omitempty"` // Package-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details. + Relationship string `json:"relationship,omitempty"` // A notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency. + Scope string `json:"scope,omitempty"` // A notation of whether the dependency is required for the primary build artifact (runtime) or is only used for development. Future versions of this specification may allow for more granular scopes. } -// Contributor represents the Contributor schema from the OpenAPI specification -type Contributor struct { - Contributions int `json:"contributions"` - Gravatar_id string `json:"gravatar_id,omitempty"` - Node_id string `json:"node_id,omitempty"` - Repos_url string `json:"repos_url,omitempty"` - Starred_url string `json:"starred_url,omitempty"` - User_view_type string `json:"user_view_type,omitempty"` - Following_url string `json:"following_url,omitempty"` - Id int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Avatar_url string `json:"avatar_url,omitempty"` - Login string `json:"login,omitempty"` - Events_url string `json:"events_url,omitempty"` - Followers_url string `json:"followers_url,omitempty"` - Subscriptions_url string `json:"subscriptions_url,omitempty"` - Email string `json:"email,omitempty"` - Received_events_url string `json:"received_events_url,omitempty"` - Url string `json:"url,omitempty"` - Html_url string `json:"html_url,omitempty"` - Organizations_url string `json:"organizations_url,omitempty"` - Site_admin bool `json:"site_admin,omitempty"` - TypeField string `json:"type"` - Gists_url string `json:"gists_url,omitempty"` +// GeneratedType_Team_project represents the GeneratedType_Team_project schema from the OpenAPI specification +type GeneratedType_Team_project struct { + Updated_at string `json:"updated_at"` + Private bool `json:"private,omitempty"` // Whether the project is private or not. Only present when owner is an organization. + Node_id string `json:"node_id"` + Organization_permission string `json:"organization_permission,omitempty"` // The organization permission for this project. Only present when owner is an organization. + Html_url string `json:"html_url"` + Id int `json:"id"` + Number int `json:"number"` + Columns_url string `json:"columns_url"` + Permissions map[string]interface{} `json:"permissions"` + Name string `json:"name"` + Body string `json:"body"` + Creator GeneratedType_Simple_user `json:"creator"` // A GitHub user. + Owner_url string `json:"owner_url"` + Created_at string `json:"created_at"` + Url string `json:"url"` + State string `json:"state"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Patterns_allowed []string `json:"patterns_allowed,omitempty"` // Specifies a list of string-matching patterns to allow specific action(s) and reusable workflow(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`. > [!NOTE] > The `patterns_allowed` setting only applies to public repositories. - Verified_allowed bool `json:"verified_allowed,omitempty"` // Whether actions from GitHub Marketplace verified creators are allowed. Set to `true` to allow all actions by GitHub Marketplace verified creators. - Github_owned_allowed bool `json:"github_owned_allowed,omitempty"` // Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization. +// GeneratedType_Webhook_repository_publicized represents the GeneratedType_Webhook_repository_publicized schema from the OpenAPI specification +type GeneratedType_Webhook_repository_publicized struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// Deployment represents the Deployment schema from the OpenAPI specification -type Deployment struct { - Environment string `json:"environment"` // Name for the target deployment environment. - Performed_via_github_app GeneratedType `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Url string `json:"url"` - Repository_url string `json:"repository_url"` - Statuses_url string `json:"statuses_url"` - Id int64 `json:"id"` // Unique identifier of the deployment - Task string `json:"task"` // Parameter to specify a task to execute - Creator GeneratedType `json:"creator"` // A GitHub user. - Node_id string `json:"node_id"` - Ref string `json:"ref"` // The ref to deploy. This can be a branch, tag, or sha. - Sha string `json:"sha"` - Transient_environment bool `json:"transient_environment,omitempty"` // Specifies if the given environment is will no longer exist at some point in the future. Default: false. - Created_at string `json:"created_at"` - Original_environment string `json:"original_environment,omitempty"` - Updated_at string `json:"updated_at"` - Description string `json:"description"` - Payload interface{} `json:"payload"` - Production_environment bool `json:"production_environment,omitempty"` // Specifies if the given environment is one that end-users directly interact with. Default: false. +// GeneratedType_Webhook_installation_suspend represents the GeneratedType_Webhook_installation_suspend schema from the OpenAPI specification +type GeneratedType_Webhook_installation_suspend struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation Installation `json:"installation"` // Installation + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repositories []map[string]interface{} `json:"repositories,omitempty"` // An array of repository objects that the installation can access. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Requester interface{} `json:"requester,omitempty"` + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_check_suite_rerequested represents the GeneratedType_Webhook_check_suite_rerequested schema from the OpenAPI specification +type GeneratedType_Webhook_check_suite_rerequested struct { Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Check_suite map[string]interface{} `json:"check_suite"` // The [check_suite](https://docs.github.com/rest/checks/suites#get-a-check-suite). + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Payload string `json:"payload"` // A URL-encoded string of the check_run.requested_action JSON payload. The decoded payload is a JSON object. +// GeneratedType_State_change_issue_event represents the GeneratedType_State_change_issue_event schema from the OpenAPI specification +type GeneratedType_State_change_issue_event struct { + Node_id string `json:"node_id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Id int `json:"id"` + Commit_id string `json:"commit_id"` + Commit_url string `json:"commit_url"` + Url string `json:"url"` + State_reason string `json:"state_reason,omitempty"` + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Created_at string `json:"created_at"` + Event string `json:"event"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Owner []int `json:"owner"` - All []int `json:"all"` +// GeneratedType_Webhook_code_scanning_alert_reopened_by_user represents the GeneratedType_Webhook_code_scanning_alert_reopened_by_user schema from the OpenAPI specification +type GeneratedType_Webhook_code_scanning_alert_reopened_by_user struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// Language represents the Language schema from the OpenAPI specification -type Language struct { +// GeneratedType_Repository_rule_params_required_reviewer_configuration represents the GeneratedType_Repository_rule_params_required_reviewer_configuration schema from the OpenAPI specification +type GeneratedType_Repository_rule_params_required_reviewer_configuration struct { + File_patterns []string `json:"file_patterns"` // Array of file patterns. Pull requests which change matching files must be approved by the specified team. File patterns use the same syntax as `.gitignore` files. + Minimum_approvals int `json:"minimum_approvals"` // Minimum number of approvals required from the specified team. If set to zero, the team will be added to the pull request but approval is optional. + Reviewer GeneratedType_Repository_rule_params_reviewer `json:"reviewer"` // A required reviewing team } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Webhook_issues_unlocked represents the GeneratedType_Webhook_issues_unlocked schema from the OpenAPI specification +type GeneratedType_Webhook_issues_unlocked struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Author GeneratedType `json:"author"` // A GitHub user. - Total int `json:"total"` - Weeks []map[string]interface{} `json:"weeks"` +// GeneratedType_Webhook_repository_vulnerability_alert_reopen represents the GeneratedType_Webhook_repository_vulnerability_alert_reopen schema from the OpenAPI specification +type GeneratedType_Webhook_repository_vulnerability_alert_reopen struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Alert Webhooksalert `json:"alert"` // The security alert of the vulnerable dependency. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Html_url string `json:"html_url"` - Key string `json:"key"` - Name string `json:"name"` - Url string `json:"url"` - Body string `json:"body,omitempty"` +// GeneratedType_App_permissions represents the GeneratedType_App_permissions schema from the OpenAPI specification +type GeneratedType_App_permissions struct { + Administration string `json:"administration,omitempty"` // The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. + Environments string `json:"environments,omitempty"` // The level of permission to grant the access token for managing repository environments. + Organization_copilot_seat_management string `json:"organization_copilot_seat_management,omitempty"` // The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change. + Organization_self_hosted_runners string `json:"organization_self_hosted_runners,omitempty"` // The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. + Pull_requests string `json:"pull_requests,omitempty"` // The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. + Organization_events string `json:"organization_events,omitempty"` // The level of permission to grant the access token to view events triggered by an activity in an organization. + Security_events string `json:"security_events,omitempty"` // The level of permission to grant the access token to view and manage security events like code scanning alerts. + Repository_hooks string `json:"repository_hooks,omitempty"` // The level of permission to grant the access token to manage the post-receive hooks for a repository. + Organization_custom_properties string `json:"organization_custom_properties,omitempty"` // The level of permission to grant the access token for custom property management. + Statuses string `json:"statuses,omitempty"` // The level of permission to grant the access token for commit statuses. + Followers string `json:"followers,omitempty"` // The level of permission to grant the access token to manage the followers belonging to a user. + Email_addresses string `json:"email_addresses,omitempty"` // The level of permission to grant the access token to manage the email addresses belonging to a user. + Repository_projects string `json:"repository_projects,omitempty"` // The level of permission to grant the access token to manage repository projects, columns, and cards. + Organization_custom_roles string `json:"organization_custom_roles,omitempty"` // The level of permission to grant the access token for custom repository roles management. + Secrets string `json:"secrets,omitempty"` // The level of permission to grant the access token to manage repository secrets. + Organization_custom_org_roles string `json:"organization_custom_org_roles,omitempty"` // The level of permission to grant the access token for custom organization roles management. + Packages string `json:"packages,omitempty"` // The level of permission to grant the access token for packages published to GitHub Packages. + Organization_announcement_banners string `json:"organization_announcement_banners,omitempty"` // The level of permission to grant the access token to view and manage announcement banners for an organization. + Metadata string `json:"metadata,omitempty"` // The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. + Secret_scanning_alerts string `json:"secret_scanning_alerts,omitempty"` // The level of permission to grant the access token to view and manage secret scanning alerts. + Workflows string `json:"workflows,omitempty"` // The level of permission to grant the access token to update GitHub Actions workflow files. + Team_discussions string `json:"team_discussions,omitempty"` // The level of permission to grant the access token to manage team discussions and related comments. + Interaction_limits string `json:"interaction_limits,omitempty"` // The level of permission to grant the access token to view and manage interaction limits on a repository. + Members string `json:"members,omitempty"` // The level of permission to grant the access token for organization teams and members. + Vulnerability_alerts string `json:"vulnerability_alerts,omitempty"` // The level of permission to grant the access token to manage Dependabot alerts. + Git_ssh_keys string `json:"git_ssh_keys,omitempty"` // The level of permission to grant the access token to manage git SSH keys. + Organization_secrets string `json:"organization_secrets,omitempty"` // The level of permission to grant the access token to manage organization secrets. + Organization_personal_access_token_requests string `json:"organization_personal_access_token_requests,omitempty"` // The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization. + Starring string `json:"starring,omitempty"` // The level of permission to grant the access token to list and manage repositories a user is starring. + Dependabot_secrets string `json:"dependabot_secrets,omitempty"` // The level of permission to grant the access token to manage Dependabot secrets. + Organization_plan string `json:"organization_plan,omitempty"` // The level of permission to grant the access token for viewing an organization's plan. + Checks string `json:"checks,omitempty"` // The level of permission to grant the access token for checks on code. + Deployments string `json:"deployments,omitempty"` // The level of permission to grant the access token for deployments and deployment statuses. + Organization_user_blocking string `json:"organization_user_blocking,omitempty"` // The level of permission to grant the access token to view and manage users blocked by the organization. + Pages string `json:"pages,omitempty"` // The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. + Organization_administration string `json:"organization_administration,omitempty"` // The level of permission to grant the access token to manage access to an organization. + Codespaces string `json:"codespaces,omitempty"` // The level of permission to grant the access token to create, edit, delete, and list Codespaces. + Repository_custom_properties string `json:"repository_custom_properties,omitempty"` // The level of permission to grant the access token to view and edit custom properties for a repository, when allowed by the property. + Actions string `json:"actions,omitempty"` // The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. + Gpg_keys string `json:"gpg_keys,omitempty"` // The level of permission to grant the access token to view and manage GPG keys belonging to a user. + Organization_personal_access_tokens string `json:"organization_personal_access_tokens,omitempty"` // The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization. + Organization_packages string `json:"organization_packages,omitempty"` // The level of permission to grant the access token for organization packages published to GitHub Packages. + Issues string `json:"issues,omitempty"` // The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. + Contents string `json:"contents,omitempty"` // The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. + Organization_projects string `json:"organization_projects,omitempty"` // The level of permission to grant the access token to manage organization projects and projects public preview (where available). + Profile string `json:"profile,omitempty"` // The level of permission to grant the access token to manage the profile settings belonging to a user. + Single_file string `json:"single_file,omitempty"` // The level of permission to grant the access token to manage just a single file. + Organization_hooks string `json:"organization_hooks,omitempty"` // The level of permission to grant the access token to manage the post-receive hooks for an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Run_id int `json:"run_id,omitempty"` // ID of the corresponding run. - Run_url string `json:"run_url,omitempty"` // URL of the corresponding run. +// GeneratedType_Release_notes_content represents the GeneratedType_Release_notes_content schema from the OpenAPI specification +type GeneratedType_Release_notes_content struct { + Body string `json:"body"` // The generated body describing the contents of the release supporting markdown formatting + Name string `json:"name"` // The generated name of the release } -// Traffic represents the Traffic schema from the OpenAPI specification -type Traffic struct { - Count int `json:"count"` - Timestamp string `json:"timestamp"` - Uniques int `json:"uniques"` +// GeneratedType_Webhook_dependabot_alert_dismissed represents the GeneratedType_Webhook_dependabot_alert_dismissed schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_dismissed struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Database_commit_sha string `json:"database_commit_sha,omitempty"` // The SHA of the commit the CodeQL database was built against. This is only available for successful analyses. - Failure_message string `json:"failure_message,omitempty"` // The reason of the failure of this repo task. This is only available if the repository task has failed. - Repository GeneratedType `json:"repository"` // A GitHub repository. - Result_count int `json:"result_count,omitempty"` // The number of results in the case of a successful analysis. This is only available for successful analyses. - Source_location_prefix string `json:"source_location_prefix,omitempty"` // The source location prefix to use. This is only available for successful analyses. - Analysis_status string `json:"analysis_status"` // The new status of the CodeQL variant analysis repository task. - Artifact_size_in_bytes int `json:"artifact_size_in_bytes,omitempty"` // The size of the artifact. This is only available for successful analyses. - Artifact_url string `json:"artifact_url,omitempty"` // The URL of the artifact. This is only available for successful analyses. +// GeneratedType_Webhook_branch_protection_configuration_disabled represents the GeneratedType_Webhook_branch_protection_configuration_disabled schema from the OpenAPI specification +type GeneratedType_Webhook_branch_protection_configuration_disabled struct { + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Id int `json:"id"` // The ID of the installation. - Node_id string `json:"node_id"` // The global node ID of the installation. +// GeneratedType_Actions_cache_usage_org_enterprise represents the GeneratedType_Actions_cache_usage_org_enterprise schema from the OpenAPI specification +type GeneratedType_Actions_cache_usage_org_enterprise struct { + Total_active_caches_count int `json:"total_active_caches_count"` // The count of active caches across all repositories of an enterprise or an organization. + Total_active_caches_size_in_bytes int `json:"total_active_caches_size_in_bytes"` // The total size in bytes of all active cache items across all repositories of an enterprise or an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Ref string `json:"ref"` // The Git reference of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Commit_oid string `json:"commit_oid"` // The commit SHA of the code scanning alert. When the action is `reopened_by_user` or `closed_by_user`, the event was triggered by the `sender` and this value will be empty. - Action string `json:"action"` - Sender GeneratedType `json:"sender"` // A GitHub user. - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Alert map[string]interface{} `json:"alert"` // The code scanning alert involved in the event. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Auto_merge represents the GeneratedType_Auto_merge schema from the OpenAPI specification +type GeneratedType_Auto_merge struct { + Enabled_by GeneratedType_Simple_user `json:"enabled_by"` // A GitHub user. + Merge_method string `json:"merge_method"` // The merge method to use. + Commit_message string `json:"commit_message"` // Commit message for the merge commit. + Commit_title string `json:"commit_title"` // Title for the merge commit message. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2 GeneratedType `json:"projects_v2"` // A projects v2 project - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_sub_issues_parent_issue_removed represents the GeneratedType_Webhook_sub_issues_parent_issue_removed schema from the OpenAPI specification +type GeneratedType_Webhook_sub_issues_parent_issue_removed struct { + Parent_issue_id float64 `json:"parent_issue_id"` // The ID of the parent issue. + Parent_issue_repo Repository `json:"parent_issue_repo"` // A repository on GitHub. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Sub_issue_id float64 `json:"sub_issue_id"` // The ID of the sub-issue. Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Parameters map[string]interface{} `json:"parameters,omitempty"` - TypeField string `json:"type"` + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Sub_issue Issue `json:"sub_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + Parent_issue Issue `json:"parent_issue"` // Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Actor GeneratedType `json:"actor"` // A GitHub user. - Commit_url string `json:"commit_url"` - Id int `json:"id"` - State_reason string `json:"state_reason,omitempty"` - Node_id string `json:"node_id"` - Url string `json:"url"` - Commit_id string `json:"commit_id"` +// Webhookssponsorship represents the Webhookssponsorship schema from the OpenAPI specification +type Webhookssponsorship struct { + Sponsorable map[string]interface{} `json:"sponsorable"` + Tier map[string]interface{} `json:"tier"` // The `tier_changed` and `pending_tier_change` will include the original tier before the change or pending change. For more information, see the pending tier change payload. Created_at string `json:"created_at"` - Event string `json:"event"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Maintainer map[string]interface{} `json:"maintainer,omitempty"` + Node_id string `json:"node_id"` + Privacy_level string `json:"privacy_level"` + Sponsor map[string]interface{} `json:"sponsor"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enabled bool `json:"enabled,omitempty"` // Whether public IP is enabled. - Length int `json:"length,omitempty"` // The length of the IP prefix. - Prefix string `json:"prefix,omitempty"` // The prefix for the public IP. +// GeneratedType_Webhook_pull_request_review_dismissed represents the GeneratedType_Webhook_pull_request_review_dismissed schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_review_dismissed struct { + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Review map[string]interface{} `json:"review"` // The review that was affected. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Commit_sha string `json:"commit_sha,omitempty"` - Message map[string]interface{} `json:"message,omitempty"` - State string `json:"state,omitempty"` // State of a code scanning alert. - Html_url string `json:"html_url,omitempty"` - Location GeneratedType `json:"location,omitempty"` // Describe a region within a file for the alert. - Analysis_key string `json:"analysis_key,omitempty"` // Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. - Category string `json:"category,omitempty"` // Identifies the configuration under which the analysis was executed. Used to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code. - Environment string `json:"environment,omitempty"` // Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed. - Ref string `json:"ref,omitempty"` // The Git reference, formatted as `refs/pull//merge`, `refs/pull//head`, `refs/heads/` or simply ``. - Classifications []string `json:"classifications,omitempty"` // Classifications that have been applied to the file that triggered the alert. For example identifying it as documentation, or a generated file. +// GeneratedType_Webhook_meta_deleted represents the GeneratedType_Webhook_meta_deleted schema from the OpenAPI specification +type GeneratedType_Webhook_meta_deleted struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Nullable_repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Hook map[string]interface{} `json:"hook"` // The deleted webhook. This will contain different keys based on the type of webhook it is: repository, organization, business, app, or GitHub Marketplace. + Hook_id int `json:"hook_id"` // The id of the modified webhook. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Views []Traffic `json:"views"` - Count int `json:"count"` - Uniques int `json:"uniques"` +// GeneratedType_Secret_scanning_location represents the GeneratedType_Secret_scanning_location schema from the OpenAPI specification +type GeneratedType_Secret_scanning_location struct { + Details interface{} `json:"details,omitempty"` + TypeField string `json:"type,omitempty"` // The location type. Because secrets may be found in different types of resources (ie. code, comments, issues, pull requests, discussions), this field identifies the type of resource where the secret was found. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id"` - Requested_team Team `json:"requested_team,omitempty"` // Groups of organization members that gives permissions on specified repositories. - Actor GeneratedType `json:"actor"` // A GitHub user. - Commit_url string `json:"commit_url"` - Url string `json:"url"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Review_requester GeneratedType `json:"review_requester"` // A GitHub user. - Requested_reviewer GeneratedType `json:"requested_reviewer,omitempty"` // A GitHub user. - Commit_id string `json:"commit_id"` +// GeneratedType_Repo_codespaces_secret represents the GeneratedType_Repo_codespaces_secret schema from the OpenAPI specification +type GeneratedType_Repo_codespaces_secret struct { Created_at string `json:"created_at"` - Event string `json:"event"` - Id int `json:"id"` -} - -// Webhooksissue represents the Webhooksissue schema from the OpenAPI specification -type Webhooksissue struct { - State_reason string `json:"state_reason,omitempty"` - Pull_request map[string]interface{} `json:"pull_request,omitempty"` - Url string `json:"url"` // URL for the issue - TypeField GeneratedType `json:"type,omitempty"` // The type of issue. - Draft bool `json:"draft,omitempty"` - Author_association string `json:"author_association"` // How the author is associated with the repository. + Name string `json:"name"` // The name of the secret. Updated_at string `json:"updated_at"` - Active_lock_reason string `json:"active_lock_reason"` - Id int64 `json:"id"` - Assignee map[string]interface{} `json:"assignee,omitempty"` - Node_id string `json:"node_id"` - Labels []map[string]interface{} `json:"labels,omitempty"` - Assignees []map[string]interface{} `json:"assignees"` - Html_url string `json:"html_url"` - Labels_url string `json:"labels_url"` - Milestone map[string]interface{} `json:"milestone"` // A collection of related issues and pull requests. - Closed_at string `json:"closed_at"` - Body string `json:"body"` // Contents of the issue - Comments int `json:"comments"` - Performed_via_github_app map[string]interface{} `json:"performed_via_github_app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Title string `json:"title"` // Title of the issue - Number int `json:"number"` - Repository_url string `json:"repository_url"` - User map[string]interface{} `json:"user"` - Events_url string `json:"events_url"` - Reactions map[string]interface{} `json:"reactions"` - Locked bool `json:"locked,omitempty"` - State string `json:"state,omitempty"` // State of the issue; either 'open' or 'closed' - Comments_url string `json:"comments_url"` - Sub_issues_summary map[string]interface{} `json:"sub_issues_summary,omitempty"` - Created_at string `json:"created_at"` - Timeline_url string `json:"timeline_url,omitempty"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` // The action that was performed. - Assignee Webhooksusermannequin `json:"assignee,omitempty"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Cards_url string `json:"cards_url"` - Created_at string `json:"created_at"` - Id int `json:"id"` // The unique identifier of the project column - Name string `json:"name"` // Name of the project column +// GeneratedType_Nullable_license_simple represents the GeneratedType_Nullable_license_simple schema from the OpenAPI specification +type GeneratedType_Nullable_license_simple struct { + Html_url string `json:"html_url,omitempty"` + Key string `json:"key"` + Name string `json:"name"` Node_id string `json:"node_id"` - Project_url string `json:"project_url"` - Updated_at string `json:"updated_at"` + Spdx_id string `json:"spdx_id"` Url string `json:"url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Updated_at string `json:"updated_at"` - Body string `json:"body,omitempty"` // Body of the status update - Creator GeneratedType `json:"creator,omitempty"` // A GitHub user. - Id float64 `json:"id"` - Start_date string `json:"start_date,omitempty"` - Target_date string `json:"target_date,omitempty"` - Node_id string `json:"node_id"` - Project_node_id string `json:"project_node_id,omitempty"` - Created_at string `json:"created_at"` - Status string `json:"status,omitempty"` +// GeneratedType_Webhook_pull_request_edited represents the GeneratedType_Webhook_pull_request_edited schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_edited struct { + Pull_request GeneratedType_Pull_request_webhook `json:"pull_request"` + Changes map[string]interface{} `json:"changes"` // The changes to the comment if the action was `edited`. + Number int `json:"number"` // The pull request number. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender,omitempty"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Name string `json:"name"` // The name of the role. - Base_role string `json:"base_role,omitempty"` // The system role from which this role inherits permissions. - Organization GeneratedType `json:"organization"` // A GitHub user. - Source string `json:"source,omitempty"` // Source answers the question, "where did this role come from?" - Updated_at string `json:"updated_at"` // The date and time the role was last updated. - Description string `json:"description,omitempty"` // A short description about who this role is for or what permissions it grants. - Permissions []string `json:"permissions"` // A list of permissions included in this role. - Created_at string `json:"created_at"` // The date and time the role was created. - Id int64 `json:"id"` // The unique identifier of the role. +// GeneratedType_Pages_deployment_status represents the GeneratedType_Pages_deployment_status schema from the OpenAPI specification +type GeneratedType_Pages_deployment_status struct { + Status string `json:"status,omitempty"` // The current status of the deployment. +} + +// Webhooksuser represents the Webhooksuser schema from the OpenAPI specification +type Webhooksuser struct { + Login string `json:"login"` + Email string `json:"email,omitempty"` + Followers_url string `json:"followers_url,omitempty"` + Repos_url string `json:"repos_url,omitempty"` + Html_url string `json:"html_url,omitempty"` + Site_admin bool `json:"site_admin,omitempty"` + Gists_url string `json:"gists_url,omitempty"` + Url string `json:"url,omitempty"` + Subscriptions_url string `json:"subscriptions_url,omitempty"` + Following_url string `json:"following_url,omitempty"` + Starred_url string `json:"starred_url,omitempty"` + User_view_type string `json:"user_view_type,omitempty"` + Name string `json:"name,omitempty"` + Organizations_url string `json:"organizations_url,omitempty"` + Avatar_url string `json:"avatar_url,omitempty"` + Gravatar_id string `json:"gravatar_id,omitempty"` + Received_events_url string `json:"received_events_url,omitempty"` + Deleted bool `json:"deleted,omitempty"` + TypeField string `json:"type,omitempty"` + Id int64 `json:"id"` + Node_id string `json:"node_id,omitempty"` + Events_url string `json:"events_url,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Repository_ruleset GeneratedType `json:"repository_ruleset"` // A set of rules to apply when specified conditions are met. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Contributor_activity represents the GeneratedType_Contributor_activity schema from the OpenAPI specification +type GeneratedType_Contributor_activity struct { + Weeks []map[string]interface{} `json:"weeks"` + Author GeneratedType_Nullable_simple_user `json:"author"` // A GitHub user. + Total int `json:"total"` } -// Email represents the Email schema from the OpenAPI specification -type Email struct { - Primary bool `json:"primary"` - Verified bool `json:"verified"` - Visibility string `json:"visibility"` - Email string `json:"email"` +// GeneratedType_Code_scanning_organization_alert_items represents the GeneratedType_Code_scanning_organization_alert_items schema from the OpenAPI specification +type GeneratedType_Code_scanning_organization_alert_items struct { + Most_recent_instance GeneratedType_Code_scanning_alert_instance `json:"most_recent_instance"` + Number int `json:"number"` // The security alert number. + Html_url string `json:"html_url"` // The GitHub URL of the alert resource. + Rule GeneratedType_Code_scanning_alert_rule_summary `json:"rule"` + Url string `json:"url"` // The REST API URL of the alert resource. + State string `json:"state"` // State of a code scanning alert. + Dismissed_at string `json:"dismissed_at"` // The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Dismissed_reason string `json:"dismissed_reason"` // **Required when the state is dismissed.** The reason for dismissing or closing the alert. + Dismissal_approved_by GeneratedType_Nullable_simple_user `json:"dismissal_approved_by,omitempty"` // A GitHub user. + Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Created_at string `json:"created_at"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Tool GeneratedType_Code_scanning_analysis_tool `json:"tool"` + Instances_url string `json:"instances_url"` // The REST API URL for fetching the list of instances for an alert. + Fixed_at string `json:"fixed_at,omitempty"` // The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + Repository GeneratedType_Simple_repository `json:"repository"` // A GitHub repository. + Dismissed_by GeneratedType_Nullable_simple_user `json:"dismissed_by"` // A GitHub user. + Dismissed_comment string `json:"dismissed_comment,omitempty"` // The dismissal comment associated with the dismissal of the alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Check_suite map[string]interface{} `json:"check_suite"` // The [check_suite](https://docs.github.com/rest/checks/suites#get-a-check-suite). - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." +// GeneratedType_Actions_get_default_workflow_permissions represents the GeneratedType_Actions_get_default_workflow_permissions schema from the OpenAPI specification +type GeneratedType_Actions_get_default_workflow_permissions struct { + Can_approve_pull_request_reviews bool `json:"can_approve_pull_request_reviews"` // Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. + Default_workflow_permissions string `json:"default_workflow_permissions"` // The default workflow permissions granted to the GITHUB_TOKEN when running workflows. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Discussion_title_url string `json:"discussion_title_url"` // The URL to the discussion where the secret was detected. +// GeneratedType_Codespaces_org_secret represents the GeneratedType_Codespaces_org_secret schema from the OpenAPI specification +type GeneratedType_Codespaces_org_secret struct { + Created_at string `json:"created_at"` // The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Name string `json:"name"` // The name of the secret + Selected_repositories_url string `json:"selected_repositories_url,omitempty"` // The API URL at which the list of repositories this secret is visible to can be retrieved + Updated_at string `json:"updated_at"` // The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Visibility string `json:"visibility"` // The type of repositories in the organization that the secret is visible to } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Blob_sha string `json:"blob_sha"` // SHA-1 hash ID of the associated blob - Commit_sha string `json:"commit_sha"` // SHA-1 hash ID of the associated commit - Commit_url string `json:"commit_url"` // The GitHub URL to get the associated wiki commit - End_column float64 `json:"end_column"` // The column at which the secret ends within the end line when the file is interpreted as 8-bit ASCII. - Page_url string `json:"page_url"` // The GitHub URL to get the associated wiki page - Start_column float64 `json:"start_column"` // The column at which the secret starts within the start line when the file is interpreted as 8-bit ASCII. - End_line float64 `json:"end_line"` // Line number at which the secret ends in the file - Path string `json:"path"` // The file path of the wiki page - Start_line float64 `json:"start_line"` // Line number at which the secret starts in the file +// Metadata represents the Metadata schema from the OpenAPI specification +type Metadata struct { } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Node_id string `json:"node_id,omitempty"` - TypeField string `json:"type,omitempty"` // Whether this rule targets a branch or tag. - Id int `json:"id,omitempty"` // The unique identifier of the branch or tag policy. - Name string `json:"name,omitempty"` // The name pattern that branches or tags must match in order to deploy to the environment. +// GeneratedType_Code_scanning_default_setup_update_response represents the GeneratedType_Code_scanning_default_setup_update_response schema from the OpenAPI specification +type GeneratedType_Code_scanning_default_setup_update_response struct { + Run_id int `json:"run_id,omitempty"` // ID of the corresponding run. + Run_url string `json:"run_url,omitempty"` // URL of the corresponding run. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Repositories []map[string]interface{} `json:"repositories,omitempty"` // Repositories in which users used Copilot for Pull Requests to generate pull request summaries - Total_engaged_users int `json:"total_engaged_users,omitempty"` // The number of users who used Copilot for Pull Requests on github.com to generate a pull request summary at least once. +// GeneratedType_Pages_source_hash represents the GeneratedType_Pages_source_hash schema from the OpenAPI specification +type GeneratedType_Pages_source_hash struct { + Branch string `json:"branch"` + Path string `json:"path"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { +// GeneratedType_Nullable_collaborator represents the GeneratedType_Nullable_collaborator schema from the OpenAPI specification +type GeneratedType_Nullable_collaborator struct { Html_url string `json:"html_url"` - Key string `json:"key"` - Name string `json:"name"` + Avatar_url string `json:"avatar_url"` + Events_url string `json:"events_url"` + Subscriptions_url string `json:"subscriptions_url"` + Following_url string `json:"following_url"` + Received_events_url string `json:"received_events_url"` Url string `json:"url"` + TypeField string `json:"type"` + Email string `json:"email,omitempty"` + Gists_url string `json:"gists_url"` + Gravatar_id string `json:"gravatar_id"` + Login string `json:"login"` + Name string `json:"name,omitempty"` + Site_admin bool `json:"site_admin"` + Starred_url string `json:"starred_url"` + Repos_url string `json:"repos_url"` + Followers_url string `json:"followers_url"` + Id int64 `json:"id"` + Node_id string `json:"node_id"` + Organizations_url string `json:"organizations_url"` + Role_name string `json:"role_name"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + User_view_type string `json:"user_view_type,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Include_claim_keys []string `json:"include_claim_keys,omitempty"` // Array of unique strings. Each claim key can only contain alphanumeric characters and underscores. - Use_default bool `json:"use_default"` // Whether to use the default template or not. If `true`, the `include_claim_keys` field is ignored. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Raw_details string `json:"raw_details"` - Start_line int `json:"start_line"` - Message string `json:"message"` - Blob_href string `json:"blob_href"` - Start_column int `json:"start_column"` - Title string `json:"title"` - Annotation_level string `json:"annotation_level"` - End_column int `json:"end_column"` - End_line int `json:"end_line"` - Path string `json:"path"` -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Projects_v2_status_update GeneratedType `json:"projects_v2_status_update"` // An status update belonging to a project - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_branch_protection_rule_edited represents the GeneratedType_Webhook_branch_protection_rule_edited schema from the OpenAPI specification +type GeneratedType_Webhook_branch_protection_rule_edited struct { + Changes map[string]interface{} `json:"changes,omitempty"` // If the action was `edited`, the changes to the rule. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Rule Webhooksrule `json:"rule"` // The branch protection rule. Includes a `name` and all the [branch protection settings](https://docs.github.com/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-settings) applied to branches that match the name. Binary settings are boolean. Multi-level configurations are one of `off`, `non_admins`, or `everyone`. Actor and build lists are arrays of strings. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Changes map[string]interface{} `json:"changes,omitempty"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Body_text string `json:"body_text,omitempty"` - Body_html string `json:"body_html,omitempty"` - Original_position int `json:"original_position"` - Subject_type string `json:"subject_type,omitempty"` // The level at which the comment is targeted, can be a diff line or a file. - In_reply_to_id int `json:"in_reply_to_id,omitempty"` - Author_association string `json:"author_association"` // How the author is associated with the repository. - Path string `json:"path"` - Updated_at string `json:"updated_at"` - Diff_hunk string `json:"diff_hunk"` - Created_at string `json:"created_at"` +// GeneratedType_Team_repository represents the GeneratedType_Team_repository schema from the OpenAPI specification +type GeneratedType_Team_repository struct { + Ssh_url string `json:"ssh_url"` + Issue_events_url string `json:"issue_events_url"` Node_id string `json:"node_id"` - Url string `json:"url"` - Position int `json:"position"` + Contents_url string `json:"contents_url"` + Svn_url string `json:"svn_url"` + Blobs_url string `json:"blobs_url"` + Forks_url string `json:"forks_url"` + Name string `json:"name"` // The name of the repository. + Language string `json:"language"` + Assignees_url string `json:"assignees_url"` + Git_commits_url string `json:"git_commits_url"` + Milestones_url string `json:"milestones_url"` + Updated_at string `json:"updated_at"` + Fork bool `json:"fork"` + Hooks_url string `json:"hooks_url"` + Issue_comment_url string `json:"issue_comment_url"` + Languages_url string `json:"languages_url"` + Teams_url string `json:"teams_url"` + Network_count int `json:"network_count,omitempty"` + Owner GeneratedType_Nullable_simple_user `json:"owner"` // A GitHub user. + Private bool `json:"private"` // Whether the repository is private or public. + Git_refs_url string `json:"git_refs_url"` + Has_projects bool `json:"has_projects"` // Whether projects are enabled. + Allow_auto_merge bool `json:"allow_auto_merge,omitempty"` // Whether to allow Auto-merge to be used on pull requests. + Deployments_url string `json:"deployments_url"` + Statuses_url string `json:"statuses_url"` + Notifications_url string `json:"notifications_url"` + Has_downloads bool `json:"has_downloads"` // Whether downloads are enabled. + Size int `json:"size"` + Allow_forking bool `json:"allow_forking,omitempty"` // Whether to allow forking this repo + Allow_squash_merge bool `json:"allow_squash_merge,omitempty"` // Whether to allow squash merges for pull requests. + Clone_url string `json:"clone_url"` + Contributors_url string `json:"contributors_url"` + Master_branch string `json:"master_branch,omitempty"` + Subscribers_url string `json:"subscribers_url"` + Events_url string `json:"events_url"` + Role_name string `json:"role_name,omitempty"` + Topics []string `json:"topics,omitempty"` + Branches_url string `json:"branches_url"` + Has_issues bool `json:"has_issues"` // Whether issues are enabled. + Stargazers_url string `json:"stargazers_url"` + Has_wiki bool `json:"has_wiki"` // Whether the wiki is enabled. + Git_tags_url string `json:"git_tags_url"` + Trees_url string `json:"trees_url"` + Has_pages bool `json:"has_pages"` + Issues_url string `json:"issues_url"` + Allow_merge_commit bool `json:"allow_merge_commit,omitempty"` // Whether to allow merge commits for pull requests. + Description string `json:"description"` + Allow_rebase_merge bool `json:"allow_rebase_merge,omitempty"` // Whether to allow rebase merges for pull requests. + Visibility string `json:"visibility,omitempty"` // The repository visibility: public, private, or internal. + Merges_url string `json:"merges_url"` + Releases_url string `json:"releases_url"` + Open_issues int `json:"open_issues"` Html_url string `json:"html_url"` - Start_side string `json:"start_side,omitempty"` // The side of the first line of the range for a multi-line comment. - Body string `json:"body"` - Original_start_line int `json:"original_start_line,omitempty"` // The original first line of the range for a multi-line comment. - User GeneratedType `json:"user"` // A GitHub user. - Original_commit_id string `json:"original_commit_id"` - Pull_request_url string `json:"pull_request_url"` - Id int64 `json:"id"` - Commit_id string `json:"commit_id"` - Line int `json:"line,omitempty"` // The line of the blob to which the comment applies. The last line of the range for a multi-line comment - Pull_request_review_id int64 `json:"pull_request_review_id"` - Links map[string]interface{} `json:"_links"` - Start_line int `json:"start_line,omitempty"` // The first line of the range for a multi-line comment. - Side string `json:"side,omitempty"` // The side of the first line of the range for a multi-line comment. - Reactions GeneratedType `json:"reactions,omitempty"` - Original_line int `json:"original_line,omitempty"` // The original line of the blob to which the comment applies. The last line of the range for a multi-line comment + Forks_count int `json:"forks_count"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` // Whether to require contributors to sign off on web-based commits + Archive_url string `json:"archive_url"` + Labels_url string `json:"labels_url"` + Pushed_at string `json:"pushed_at"` + Pulls_url string `json:"pulls_url"` + Homepage string `json:"homepage"` + Is_template bool `json:"is_template,omitempty"` // Whether this repository acts as a template that can be used to generate new repositories. + Tags_url string `json:"tags_url"` + Disabled bool `json:"disabled"` // Returns whether or not this repository disabled. + Mirror_url string `json:"mirror_url"` + Archived bool `json:"archived"` // Whether the repository is archived. + Id int `json:"id"` // Unique identifier of the repository + Subscribers_count int `json:"subscribers_count,omitempty"` + Url string `json:"url"` + Created_at string `json:"created_at"` + Downloads_url string `json:"downloads_url"` + Watchers int `json:"watchers"` + Open_issues_count int `json:"open_issues_count"` + Watchers_count int `json:"watchers_count"` + Temp_clone_token string `json:"temp_clone_token,omitempty"` + Commits_url string `json:"commits_url"` + Delete_branch_on_merge bool `json:"delete_branch_on_merge,omitempty"` // Whether to delete head branches when pull requests are merged + Compare_url string `json:"compare_url"` + License GeneratedType_Nullable_license_simple `json:"license"` // License Simple + Git_url string `json:"git_url"` + Default_branch string `json:"default_branch"` // The default branch of the repository. + Full_name string `json:"full_name"` + Forks int `json:"forks"` + Keys_url string `json:"keys_url"` + Stargazers_count int `json:"stargazers_count"` + Permissions map[string]interface{} `json:"permissions,omitempty"` + Collaborators_url string `json:"collaborators_url"` + Comments_url string `json:"comments_url"` + Subscription_url string `json:"subscription_url"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Projects_v2_item GeneratedType `json:"projects_v2_item"` // An item belonging to a project +// GeneratedType_Copilot_dotcom_chat represents the GeneratedType_Copilot_dotcom_chat schema from the OpenAPI specification +type GeneratedType_Copilot_dotcom_chat struct { + Models []map[string]interface{} `json:"models,omitempty"` // List of model metrics for a custom models and the default model. + Total_engaged_users int `json:"total_engaged_users,omitempty"` // Total number of users who prompted Copilot Chat on github.com at least once. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. +// GeneratedType_Webhook_project_closed represents the GeneratedType_Webhook_project_closed schema from the OpenAPI specification +type GeneratedType_Webhook_project_closed struct { + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. Project Webhooksproject `json:"project"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Days []int `json:"days"` - Total int `json:"total"` - Week int `json:"week"` + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Has_multiple_single_files bool `json:"has_multiple_single_files,omitempty"` - Permissions GeneratedType `json:"permissions,omitempty"` // The permissions granted to the user access token. - Repositories []Repository `json:"repositories,omitempty"` - Repository_selection string `json:"repository_selection,omitempty"` - Single_file string `json:"single_file,omitempty"` - Single_file_paths []string `json:"single_file_paths,omitempty"` - Token string `json:"token"` - Expires_at string `json:"expires_at"` +// GeneratedType_Webhook_check_run_created represents the GeneratedType_Webhook_check_run_created schema from the OpenAPI specification +type GeneratedType_Webhook_check_run_created struct { + Action string `json:"action,omitempty"` + Check_run GeneratedType_Check_run_with_simple_check_suite `json:"check_run"` // A check performed on the code of a given code change + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Url string `json:"url"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Commit_url string `json:"commit_url"` - Created_at string `json:"created_at"` - Id int `json:"id"` - Milestone map[string]interface{} `json:"milestone"` - Performed_via_github_app GeneratedType `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Commit_id string `json:"commit_id"` - Event string `json:"event"` - Node_id string `json:"node_id"` +// GeneratedType_Billing_usage_report_user represents the GeneratedType_Billing_usage_report_user schema from the OpenAPI specification +type GeneratedType_Billing_usage_report_user struct { + Usageitems []map[string]interface{} `json:"usageItems,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Updated_at string `json:"updated_at"` - Closed_at string `json:"closed_at"` - Created_at string `json:"created_at"` - Description string `json:"description"` - Id float64 `json:"id"` +// Webhooksalert represents the Webhooksalert schema from the OpenAPI specification +type Webhooksalert struct { Number int `json:"number"` - Creator GeneratedType `json:"creator"` // A GitHub user. + State string `json:"state"` + Affected_range string `json:"affected_range"` + Created_at string `json:"created_at"` + Dismissed_at string `json:"dismissed_at,omitempty"` + Dismiss_reason string `json:"dismiss_reason,omitempty"` Node_id string `json:"node_id"` - Title string `json:"title"` - Deleted_at string `json:"deleted_at"` - Deleted_by GeneratedType `json:"deleted_by"` // A GitHub user. - Owner GeneratedType `json:"owner"` // A GitHub user. - Public bool `json:"public"` - Short_description string `json:"short_description"` + Affected_package_name string `json:"affected_package_name"` + Ghsa_id string `json:"ghsa_id"` + Fixed_at string `json:"fixed_at,omitempty"` + Id int `json:"id"` + External_identifier string `json:"external_identifier"` + Dismisser map[string]interface{} `json:"dismisser,omitempty"` + External_reference string `json:"external_reference"` + Fix_reason string `json:"fix_reason,omitempty"` + Severity string `json:"severity"` + Fixed_in string `json:"fixed_in,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Selected_repositories_url string `json:"selected_repositories_url,omitempty"` // The API URL to use to get or set the selected repositories that are allowed to run GitHub Actions, when `enabled_repositories` is set to `selected`. - Allowed_actions string `json:"allowed_actions,omitempty"` // The permissions policy that controls the actions and reusable workflows that are allowed to run. - Enabled_repositories string `json:"enabled_repositories"` // The policy that controls the repositories in the organization that are allowed to run GitHub Actions. - Selected_actions_url string `json:"selected_actions_url,omitempty"` // The API URL to use to get or set the actions and reusable workflows that are allowed to run, when `allowed_actions` is set to `selected`. +// GeneratedType_Webhook_projects_v2_status_update_edited represents the GeneratedType_Webhook_projects_v2_status_update_edited schema from the OpenAPI specification +type GeneratedType_Webhook_projects_v2_status_update_edited struct { + Action string `json:"action"` + Changes map[string]interface{} `json:"changes,omitempty"` + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Projects_v2_status_update GeneratedType_Projects_v2_status_update `json:"projects_v2_status_update"` // An status update belonging to a project + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Label Webhookslabel `json:"label,omitempty"` - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_branch_protection_configuration_enabled represents the GeneratedType_Webhook_branch_protection_configuration_enabled schema from the OpenAPI specification +type GeneratedType_Webhook_branch_protection_configuration_enabled struct { Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` // The changes to the issue. - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Issue map[string]interface{} `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Comment Webhookscomment `json:"comment"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Action string `json:"action"` - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Organization_actions_variable represents the GeneratedType_Organization_actions_variable schema from the OpenAPI specification +type GeneratedType_Organization_actions_variable struct { + Created_at string `json:"created_at"` // The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Name string `json:"name"` // The name of the variable. + Selected_repositories_url string `json:"selected_repositories_url,omitempty"` + Updated_at string `json:"updated_at"` // The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. + Value string `json:"value"` // The value of the variable. + Visibility string `json:"visibility"` // Visibility of a variable } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Changes map[string]interface{} `json:"changes"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` +// GeneratedType_Timeline_unassigned_issue_event represents the GeneratedType_Timeline_unassigned_issue_event schema from the OpenAPI specification +type GeneratedType_Timeline_unassigned_issue_event struct { + Created_at string `json:"created_at"` + Node_id string `json:"node_id"` + Commit_url string `json:"commit_url"` + Event string `json:"event"` + Url string `json:"url"` + Assignee GeneratedType_Simple_user `json:"assignee"` // A GitHub user. + Id int `json:"id"` + Performed_via_github_app GeneratedType_Nullable_integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Actor GeneratedType_Simple_user `json:"actor"` // A GitHub user. + Commit_id string `json:"commit_id"` } -// Root represents the Root schema from the OpenAPI specification -type Root struct { - Current_user_url string `json:"current_user_url"` - Hub_url string `json:"hub_url,omitempty"` - Current_user_authorizations_html_url string `json:"current_user_authorizations_html_url"` - Following_url string `json:"following_url"` - Topic_search_url string `json:"topic_search_url,omitempty"` - Organization_teams_url string `json:"organization_teams_url"` +// GeneratedType_Rule_suite represents the GeneratedType_Rule_suite schema from the OpenAPI specification +type GeneratedType_Rule_suite struct { + After_sha string `json:"after_sha,omitempty"` // The last commit sha in the push evaluation. + Evaluation_result string `json:"evaluation_result,omitempty"` // The result of the rule evaluations for rules with the `active` and `evaluate` enforcement statuses, demonstrating whether rules would pass or fail if all rules in the rule suite were `active`. Null if no rules with `evaluate` enforcement status were run. + Repository_id int `json:"repository_id,omitempty"` // The ID of the repository associated with the rule evaluation. + Ref string `json:"ref,omitempty"` // The ref name that the evaluation ran on. + Result string `json:"result,omitempty"` // The result of the rule evaluations for rules with the `active` enforcement status. + Rule_evaluations []map[string]interface{} `json:"rule_evaluations,omitempty"` // Details on the evaluated rules. + Actor_id int `json:"actor_id,omitempty"` // The number that identifies the user. + Before_sha string `json:"before_sha,omitempty"` // The first commit sha before the push evaluation. + Id int `json:"id,omitempty"` // The unique identifier of the rule insight. + Pushed_at string `json:"pushed_at,omitempty"` + Repository_name string `json:"repository_name,omitempty"` // The name of the repository without the `.git` extension. + Actor_name string `json:"actor_name,omitempty"` // The handle for the GitHub user account. +} + +// GeneratedType_Team_organization represents the GeneratedType_Team_organization schema from the OpenAPI specification +type GeneratedType_Team_organization struct { + TypeField string `json:"type"` Events_url string `json:"events_url"` - Organization_repositories_url string `json:"organization_repositories_url"` - Notifications_url string `json:"notifications_url"` - Repository_url string `json:"repository_url"` - Authorizations_url string `json:"authorizations_url"` - Gists_url string `json:"gists_url"` - Emails_url string `json:"emails_url"` - Issue_search_url string `json:"issue_search_url"` - User_repositories_url string `json:"user_repositories_url"` - Public_gists_url string `json:"public_gists_url"` - Commit_search_url string `json:"commit_search_url"` - Keys_url string `json:"keys_url"` - Emojis_url string `json:"emojis_url"` - Label_search_url string `json:"label_search_url"` - User_search_url string `json:"user_search_url"` - Followers_url string `json:"followers_url"` - User_url string `json:"user_url"` - Starred_url string `json:"starred_url"` - Repository_search_url string `json:"repository_search_url"` - Rate_limit_url string `json:"rate_limit_url"` - Code_search_url string `json:"code_search_url"` - Organization_url string `json:"organization_url"` - Feeds_url string `json:"feeds_url"` + Node_id string `json:"node_id"` + Members_can_create_public_pages bool `json:"members_can_create_public_pages,omitempty"` + Following int `json:"following"` + Members_can_create_pages bool `json:"members_can_create_pages,omitempty"` + Email string `json:"email,omitempty"` + Public_members_url string `json:"public_members_url"` + Is_verified bool `json:"is_verified,omitempty"` + Members_can_create_private_repositories bool `json:"members_can_create_private_repositories,omitempty"` + Members_can_create_private_pages bool `json:"members_can_create_private_pages,omitempty"` + Updated_at string `json:"updated_at"` + Members_can_create_public_repositories bool `json:"members_can_create_public_repositories,omitempty"` + Members_can_create_repositories bool `json:"members_can_create_repositories,omitempty"` + Owned_private_repos int `json:"owned_private_repos,omitempty"` + Members_url string `json:"members_url"` + Has_organization_projects bool `json:"has_organization_projects"` + Members_can_fork_private_repositories bool `json:"members_can_fork_private_repositories,omitempty"` + Id int `json:"id"` + Plan map[string]interface{} `json:"plan,omitempty"` + Members_can_create_internal_repositories bool `json:"members_can_create_internal_repositories,omitempty"` + Has_repository_projects bool `json:"has_repository_projects"` + Total_private_repos int `json:"total_private_repos,omitempty"` Issues_url string `json:"issues_url"` - Current_user_repositories_url string `json:"current_user_repositories_url"` - Starred_gists_url string `json:"starred_gists_url"` - User_organizations_url string `json:"user_organizations_url"` + Billing_email string `json:"billing_email,omitempty"` + Disk_usage int `json:"disk_usage,omitempty"` + Followers int `json:"followers"` + Private_gists int `json:"private_gists,omitempty"` + Url string `json:"url"` + Public_gists int `json:"public_gists"` + Blog string `json:"blog,omitempty"` + Html_url string `json:"html_url"` + Name string `json:"name,omitempty"` + Twitter_username string `json:"twitter_username,omitempty"` + Web_commit_signoff_required bool `json:"web_commit_signoff_required,omitempty"` + Default_repository_permission string `json:"default_repository_permission,omitempty"` + Login string `json:"login"` + Hooks_url string `json:"hooks_url"` + Members_allowed_repository_creation_type string `json:"members_allowed_repository_creation_type,omitempty"` + Repos_url string `json:"repos_url"` + Archived_at string `json:"archived_at"` + Description string `json:"description"` + Location string `json:"location,omitempty"` + Avatar_url string `json:"avatar_url"` + Created_at string `json:"created_at"` + Collaborators int `json:"collaborators,omitempty"` + Two_factor_requirement_enabled bool `json:"two_factor_requirement_enabled,omitempty"` + Public_repos int `json:"public_repos"` + Company string `json:"company,omitempty"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Registry_package map[string]interface{} `json:"registry_package"` - Repository GeneratedType `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Action string `json:"action"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." +// GeneratedType_Webhook_page_build represents the GeneratedType_Webhook_page_build schema from the OpenAPI specification +type GeneratedType_Webhook_page_build struct { + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Build map[string]interface{} `json:"build"` // The [List GitHub Pages builds](https://docs.github.com/rest/pages/pages#list-github-pages-builds) itself. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Id int `json:"id"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. +// GeneratedType_Webhook_dependabot_alert_created represents the GeneratedType_Webhook_dependabot_alert_created schema from the OpenAPI specification +type GeneratedType_Webhook_dependabot_alert_created struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. Action string `json:"action"` - Discussion Discussion `json:"discussion"` // A Discussion in a repository. + Alert GeneratedType_Dependabot_alert `json:"alert"` // A Dependabot alert. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - After string `json:"after,omitempty"` - App Integration `json:"app,omitempty"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Repository GeneratedType `json:"repository,omitempty"` // Minimal Repository - Updated_at string `json:"updated_at,omitempty"` - Id int `json:"id,omitempty"` - Pull_requests []GeneratedType `json:"pull_requests,omitempty"` - Status string `json:"status,omitempty"` - Url string `json:"url,omitempty"` - Conclusion string `json:"conclusion,omitempty"` - Head_branch string `json:"head_branch,omitempty"` - Head_sha string `json:"head_sha,omitempty"` // The SHA of the head commit that is being checked. - Node_id string `json:"node_id,omitempty"` - Before string `json:"before,omitempty"` - Created_at string `json:"created_at,omitempty"` +// GeneratedType_Webhook_secret_scanning_alert_location_created_form_encoded represents the GeneratedType_Webhook_secret_scanning_alert_location_created_form_encoded schema from the OpenAPI specification +type GeneratedType_Webhook_secret_scanning_alert_location_created_form_encoded struct { + Payload string `json:"payload"` // A URL-encoded string of the secret_scanning_alert_location.created JSON payload. The decoded payload is a JSON object. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Push_protection_bypass_request_html_url string `json:"push_protection_bypass_request_html_url,omitempty"` // The URL to a push protection bypass request. - Secret_type string `json:"secret_type,omitempty"` // The type of secret that secret scanning detected. - Push_protection_bypassed_at string `json:"push_protection_bypassed_at,omitempty"` // The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Validity string `json:"validity,omitempty"` // The token status as of the latest validity check. - Secret string `json:"secret,omitempty"` // The secret that was detected. - Has_more_locations bool `json:"has_more_locations,omitempty"` // A boolean value representing whether or not the token in the alert was detected in more than one location. - Resolved_at string `json:"resolved_at,omitempty"` // The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Url string `json:"url,omitempty"` // The REST API URL of the alert resource. - Html_url string `json:"html_url,omitempty"` // The GitHub URL of the alert resource. - Is_base64_encoded bool `json:"is_base64_encoded,omitempty"` // A boolean value representing whether or not alert is base64 encoded - Locations_url string `json:"locations_url,omitempty"` // The REST API URL of the code locations for this alert. - Push_protection_bypass_request_reviewer GeneratedType `json:"push_protection_bypass_request_reviewer,omitempty"` // A GitHub user. - Push_protection_bypassed bool `json:"push_protection_bypassed,omitempty"` // Whether push protection was bypassed for the detected secret. - Updated_at string `json:"updated_at,omitempty"` // The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Push_protection_bypassed_by GeneratedType `json:"push_protection_bypassed_by,omitempty"` // A GitHub user. - Number int `json:"number,omitempty"` // The security alert number. - Secret_type_display_name string `json:"secret_type_display_name,omitempty"` // User-friendly name for the detected secret, matching the `secret_type`. For a list of built-in patterns, see "[Supported secret scanning patterns](https://docs.github.com/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets)." - Push_protection_bypass_request_comment string `json:"push_protection_bypass_request_comment,omitempty"` // An optional comment when requesting a push protection bypass. - First_location_detected interface{} `json:"first_location_detected,omitempty"` // Details on the location where the token was initially detected. This can be a commit, wiki commit, issue, discussion, pull request. - Repository GeneratedType `json:"repository,omitempty"` // A GitHub repository. - Resolved_by GeneratedType `json:"resolved_by,omitempty"` // A GitHub user. - Publicly_leaked bool `json:"publicly_leaked,omitempty"` // Whether the secret was publicly leaked. - Push_protection_bypass_request_reviewer_comment string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` // An optional comment when reviewing a push protection bypass. - Resolution string `json:"resolution,omitempty"` // **Required when the `state` is `resolved`.** The reason for resolving the alert. - Created_at string `json:"created_at,omitempty"` // The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - Resolution_comment string `json:"resolution_comment,omitempty"` // The comment that was optionally added when this alert was closed - State string `json:"state,omitempty"` // Sets the state of the secret scanning alert. You must provide `resolution` when you set the state to `resolved`. - Multi_repo bool `json:"multi_repo,omitempty"` // Whether the detected secret was found in multiple repositories in the same organization or enterprise. +// GeneratedType_Webhook_issues_unassigned represents the GeneratedType_Webhook_issues_unassigned schema from the OpenAPI specification +type GeneratedType_Webhook_issues_unassigned struct { + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` // The action that was performed. + Assignee Webhooksusermannequin `json:"assignee,omitempty"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Issue Webhooksissue `json:"issue"` // The [issue](https://docs.github.com/rest/issues/issues#get-an-issue) itself. + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Action string `json:"action"` - Alert GeneratedType `json:"alert"` - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender,omitempty"` // A GitHub user. +// GeneratedType_Content_traffic represents the GeneratedType_Content_traffic schema from the OpenAPI specification +type GeneratedType_Content_traffic struct { + Count int `json:"count"` + Path string `json:"path"` + Title string `json:"title"` + Uniques int `json:"uniques"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Assigner GeneratedType `json:"assigner"` // A GitHub user. - Commit_url string `json:"commit_url"` - Node_id string `json:"node_id"` - Actor GeneratedType `json:"actor"` // A GitHub user. - Created_at string `json:"created_at"` +// Project represents the Project schema from the OpenAPI specification +type Project struct { + State string `json:"state"` // State of the project; either 'open' or 'closed' Id int `json:"id"` - Performed_via_github_app Integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - Assignee GeneratedType `json:"assignee"` // A GitHub user. - Commit_id string `json:"commit_id"` - Event string `json:"event"` + Name string `json:"name"` // Name of the project + Updated_at string `json:"updated_at"` + Body string `json:"body"` // Body of the project + Html_url string `json:"html_url"` Url string `json:"url"` + Node_id string `json:"node_id"` + Organization_permission string `json:"organization_permission,omitempty"` // The baseline permission that all organization members have on this project. Only present if owner is an organization. + Creator GeneratedType_Nullable_simple_user `json:"creator"` // A GitHub user. + Owner_url string `json:"owner_url"` + Private bool `json:"private,omitempty"` // Whether or not this project can be seen by everyone. Only present if owner is an organization. + Columns_url string `json:"columns_url"` + Created_at string `json:"created_at"` + Number int `json:"number"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Created_at string `json:"created_at"` // The date and time at which the variable was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Name string `json:"name"` // The name of the variable. - Selected_repositories_url string `json:"selected_repositories_url,omitempty"` - Updated_at string `json:"updated_at"` // The date and time at which the variable was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. - Value string `json:"value"` // The value of the variable. - Visibility string `json:"visibility"` // Visibility of a variable -} - -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Enterprise GeneratedType `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." - Installation GeneratedType `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." - Organization GeneratedType `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. - Repository GeneratedType `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. - Sender GeneratedType `json:"sender"` // A GitHub user. - Workflow_job interface{} `json:"workflow_job"` - Action string `json:"action"` - Deployment Deployment `json:"deployment,omitempty"` // A request for a specific ref(branch,sha,tag) to be deployed +// GeneratedType_Webhook_config represents the GeneratedType_Webhook_config schema from the OpenAPI specification +type GeneratedType_Webhook_config struct { + Content_type string `json:"content_type,omitempty"` // The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. + Insecure_ssl string `json:"insecure_ssl,omitempty"` + Secret string `json:"secret,omitempty"` // If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers). + Url string `json:"url,omitempty"` // The URL to which the payloads will be delivered. } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - TypeField string `json:"type"` +// Webhooksissuecomment represents the Webhooksissuecomment schema from the OpenAPI specification +type Webhooksissuecomment struct { + Id int64 `json:"id"` // Unique identifier of the issue comment + Node_id string `json:"node_id"` + Body string `json:"body"` // Contents of the issue comment + Created_at string `json:"created_at"` + Html_url string `json:"html_url"` + Issue_url string `json:"issue_url"` + Performed_via_github_app Integration `json:"performed_via_github_app"` // GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + Reactions map[string]interface{} `json:"reactions"` + Url string `json:"url"` // URL for the issue comment + User map[string]interface{} `json:"user"` + Author_association string `json:"author_association"` // How the author is associated with the repository. + Updated_at string `json:"updated_at"` } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Comment string `json:"comment"` // Comment associated with the pending deployment protection rule. **Required when state is not provided.** - Environment_name string `json:"environment_name"` // The name of the environment to approve or reject. +// GeneratedType_Webhook_pull_request_auto_merge_disabled represents the GeneratedType_Webhook_pull_request_auto_merge_disabled schema from the OpenAPI specification +type GeneratedType_Webhook_pull_request_auto_merge_disabled struct { + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` + Reason string `json:"reason"` + Number int `json:"number"` + Pull_request map[string]interface{} `json:"pull_request"` + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." } -// GeneratedType represents the GeneratedType schema from the OpenAPI specification -type GeneratedType struct { - Head_commit GeneratedType `json:"head_commit"` // A commit. - Head_ref string `json:"head_ref"` // The full ref of the merge group. - Head_sha string `json:"head_sha"` // The SHA of the merge group. - Base_ref string `json:"base_ref"` // The full ref of the branch the merge group will be merged into. - Base_sha string `json:"base_sha"` // The SHA of the merge group's parent commit. +// GeneratedType_Webhook_org_block_blocked represents the GeneratedType_Webhook_org_block_blocked schema from the OpenAPI specification +type GeneratedType_Webhook_org_block_blocked struct { + Blocked_user Webhooksuser `json:"blocked_user"` + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository,omitempty"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. + Action string `json:"action"` } -// Webhooksteam1 represents the Webhooksteam1 schema from the OpenAPI specification -type Webhooksteam1 struct { - Privacy string `json:"privacy,omitempty"` - Slug string `json:"slug,omitempty"` - Permission string `json:"permission,omitempty"` // Permission that the team will have for its repositories - Repositories_url string `json:"repositories_url,omitempty"` - Url string `json:"url,omitempty"` // URL for the team - Members_url string `json:"members_url,omitempty"` - Html_url string `json:"html_url,omitempty"` - Id int `json:"id"` // Unique identifier of the team - Node_id string `json:"node_id,omitempty"` - Notification_setting string `json:"notification_setting,omitempty"` // Whether team members will receive notifications when their team is @mentioned - Parent map[string]interface{} `json:"parent,omitempty"` - Deleted bool `json:"deleted,omitempty"` - Description string `json:"description,omitempty"` // Description of the team - Name string `json:"name"` // Name of the team +// GeneratedType_Webhook_repository_vulnerability_alert_resolve represents the GeneratedType_Webhook_repository_vulnerability_alert_resolve schema from the OpenAPI specification +type GeneratedType_Webhook_repository_vulnerability_alert_resolve struct { + Action string `json:"action"` + Alert map[string]interface{} `json:"alert"` // The security alert of the vulnerable dependency. + Enterprise GeneratedType_Enterprise_webhooks `json:"enterprise,omitempty"` // An enterprise on GitHub. Webhook payloads contain the `enterprise` property when the webhook is configured on an enterprise account or an organization that's part of an enterprise account. For more information, see "[About enterprise accounts](https://docs.github.com/admin/overview/about-enterprise-accounts)." + Installation GeneratedType_Simple_installation `json:"installation,omitempty"` // The GitHub App installation. Webhook payloads contain the `installation` property when the event is configured for and sent to a GitHub App. For more information, see "[Using webhooks with GitHub Apps](https://docs.github.com/apps/creating-github-apps/registering-a-github-app/using-webhooks-with-github-apps)." + Organization GeneratedType_Organization_simple_webhooks `json:"organization,omitempty"` // A GitHub organization. Webhook payloads contain the `organization` property when the webhook is configured for an organization, or when the event occurs from activity in a repository owned by an organization. + Repository GeneratedType_Repository_webhooks `json:"repository"` // The repository on GitHub where the event occurred. Webhook payloads contain the `repository` property when the event occurs from activity in a repository. + Sender GeneratedType_Simple_user `json:"sender"` // A GitHub user. } diff --git a/MCP/go/registry.go b/MCP/go/registry.go index ca79915..e572159 100644 --- a/MCP/go/registry.go +++ b/MCP/go/registry.go @@ -3,1083 +3,1083 @@ package main import ( "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" - tools_gists "github.com/github-v3-rest-api/mcp-server/tools/gists" - tools_users "github.com/github-v3-rest-api/mcp-server/tools/users" - tools_codespaces "github.com/github-v3-rest-api/mcp-server/tools/codespaces" - tools_repos "github.com/github-v3-rest-api/mcp-server/tools/repos" - tools_billing "github.com/github-v3-rest-api/mcp-server/tools/billing" tools_apps "github.com/github-v3-rest-api/mcp-server/tools/apps" - tools_teams "github.com/github-v3-rest-api/mcp-server/tools/teams" - tools_classroom "github.com/github-v3-rest-api/mcp-server/tools/classroom" - tools_actions "github.com/github-v3-rest-api/mcp-server/tools/actions" + tools_codespaces "github.com/github-v3-rest-api/mcp-server/tools/codespaces" tools_projects "github.com/github-v3-rest-api/mcp-server/tools/projects" - tools_code_security "github.com/github-v3-rest-api/mcp-server/tools/code_security" - tools_dependabot "github.com/github-v3-rest-api/mcp-server/tools/dependabot" - tools_orgs "github.com/github-v3-rest-api/mcp-server/tools/orgs" - tools_issues "github.com/github-v3-rest-api/mcp-server/tools/issues" - tools_git "github.com/github-v3-rest-api/mcp-server/tools/git" - tools_reactions "github.com/github-v3-rest-api/mcp-server/tools/reactions" + tools_repos "github.com/github-v3-rest-api/mcp-server/tools/repos" tools_migrations "github.com/github-v3-rest-api/mcp-server/tools/migrations" + tools_checks "github.com/github-v3-rest-api/mcp-server/tools/checks" + tools_orgs "github.com/github-v3-rest-api/mcp-server/tools/orgs" tools_licenses "github.com/github-v3-rest-api/mcp-server/tools/licenses" - tools_secret_scanning "github.com/github-v3-rest-api/mcp-server/tools/secret_scanning" - tools_pulls "github.com/github-v3-rest-api/mcp-server/tools/pulls" + tools_actions "github.com/github-v3-rest-api/mcp-server/tools/actions" tools_packages "github.com/github-v3-rest-api/mcp-server/tools/packages" - tools_code_scanning "github.com/github-v3-rest-api/mcp-server/tools/code_scanning" - tools_meta "github.com/github-v3-rest-api/mcp-server/tools/meta" - tools_private_registries "github.com/github-v3-rest-api/mcp-server/tools/private_registries" + tools_issues "github.com/github-v3-rest-api/mcp-server/tools/issues" + tools_gists "github.com/github-v3-rest-api/mcp-server/tools/gists" tools_activity "github.com/github-v3-rest-api/mcp-server/tools/activity" - tools_checks "github.com/github-v3-rest-api/mcp-server/tools/checks" - tools_campaigns "github.com/github-v3-rest-api/mcp-server/tools/campaigns" + tools_reactions "github.com/github-v3-rest-api/mcp-server/tools/reactions" + tools_teams "github.com/github-v3-rest-api/mcp-server/tools/teams" + tools_code_security "github.com/github-v3-rest-api/mcp-server/tools/code_security" + tools_search "github.com/github-v3-rest-api/mcp-server/tools/search" + tools_code_scanning "github.com/github-v3-rest-api/mcp-server/tools/code_scanning" + tools_dependabot "github.com/github-v3-rest-api/mcp-server/tools/dependabot" + tools_pulls "github.com/github-v3-rest-api/mcp-server/tools/pulls" + tools_classroom "github.com/github-v3-rest-api/mcp-server/tools/classroom" + tools_billing "github.com/github-v3-rest-api/mcp-server/tools/billing" + tools_users "github.com/github-v3-rest-api/mcp-server/tools/users" tools_security_advisories "github.com/github-v3-rest-api/mcp-server/tools/security_advisories" - tools_credentials "github.com/github-v3-rest-api/mcp-server/tools/credentials" + tools_secret_scanning "github.com/github-v3-rest-api/mcp-server/tools/secret_scanning" tools_copilot "github.com/github-v3-rest-api/mcp-server/tools/copilot" - tools_emojis "github.com/github-v3-rest-api/mcp-server/tools/emojis" - tools_hosted_compute "github.com/github-v3-rest-api/mcp-server/tools/hosted_compute" tools_codes_of_conduct "github.com/github-v3-rest-api/mcp-server/tools/codes_of_conduct" - tools_search "github.com/github-v3-rest-api/mcp-server/tools/search" - tools_interactions "github.com/github-v3-rest-api/mcp-server/tools/interactions" - tools_rate_limit "github.com/github-v3-rest-api/mcp-server/tools/rate_limit" - tools_gitignore "github.com/github-v3-rest-api/mcp-server/tools/gitignore" tools_dependency_graph "github.com/github-v3-rest-api/mcp-server/tools/dependency_graph" + tools_git "github.com/github-v3-rest-api/mcp-server/tools/git" + tools_meta "github.com/github-v3-rest-api/mcp-server/tools/meta" + tools_credentials "github.com/github-v3-rest-api/mcp-server/tools/credentials" + tools_hosted_compute "github.com/github-v3-rest-api/mcp-server/tools/hosted_compute" + tools_private_registries "github.com/github-v3-rest-api/mcp-server/tools/private_registries" + tools_interactions "github.com/github-v3-rest-api/mcp-server/tools/interactions" + tools_emojis "github.com/github-v3-rest-api/mcp-server/tools/emojis" tools_oidc "github.com/github-v3-rest-api/mcp-server/tools/oidc" + tools_gitignore "github.com/github-v3-rest-api/mcp-server/tools/gitignore" + tools_rate_limit "github.com/github-v3-rest-api/mcp-server/tools/rate_limit" + tools_campaigns "github.com/github-v3-rest-api/mcp-server/tools/campaigns" ) func GetAll(cfg *config.APIConfig) []models.Tool { return []models.Tool{ - tools_gists.CreateGists_get_revisionTool(cfg), - tools_users.CreateUsers_list_gpg_keys_for_userTool(cfg), + tools_apps.CreateApps_list_installationsTool(cfg), + tools_codespaces.CreateCodespaces_check_permissions_for_devcontainerTool(cfg), + tools_projects.CreateProjects_delete_cardTool(cfg), + tools_projects.CreateProjects_get_cardTool(cfg), + tools_projects.CreateProjects_update_cardTool(cfg), + tools_repos.CreateRepos_get_admin_branch_protectionTool(cfg), + tools_repos.CreateRepos_set_admin_branch_protectionTool(cfg), + tools_repos.CreateRepos_delete_admin_branch_protectionTool(cfg), + tools_migrations.CreateMigrations_delete_archive_for_orgTool(cfg), + tools_migrations.CreateMigrations_download_archive_for_orgTool(cfg), + tools_checks.CreateChecks_list_for_suiteTool(cfg), + tools_orgs.CreateOrgs_ping_webhookTool(cfg), + tools_orgs.CreateOrgs_delete_attestations_by_idTool(cfg), + tools_orgs.CreateOrgs_list_attestations_bulkTool(cfg), + tools_orgs.CreateOrgs_redeliver_webhook_deliveryTool(cfg), + tools_repos.CreateRepos_delete_commit_signature_protectionTool(cfg), + tools_repos.CreateRepos_get_commit_signature_protectionTool(cfg), + tools_repos.CreateRepos_create_commit_signature_protectionTool(cfg), + tools_licenses.CreateLicenses_get_for_repoTool(cfg), + tools_actions.CreateActions_list_org_variablesTool(cfg), + tools_actions.CreateActions_create_org_variableTool(cfg), + tools_packages.CreatePackages_get_package_version_for_authenticated_userTool(cfg), + tools_packages.CreatePackages_delete_package_version_for_authenticated_userTool(cfg), + tools_actions.CreateActions_create_remove_token_for_orgTool(cfg), + tools_codespaces.CreateCodespaces_remove_selected_repo_from_org_secretTool(cfg), + tools_codespaces.CreateCodespaces_add_selected_repo_to_org_secretTool(cfg), + tools_packages.CreatePackages_list_docker_migration_conflicting_packages_for_userTool(cfg), + tools_issues.CreateIssues_list_sub_issuesTool(cfg), + tools_issues.CreateIssues_add_sub_issueTool(cfg), + tools_gists.CreateGists_deleteTool(cfg), + tools_gists.CreateGists_getTool(cfg), + tools_gists.CreateGists_updateTool(cfg), + tools_apps.CreateApps_list_installation_requests_for_authenticated_appTool(cfg), + tools_orgs.CreateApi_insights_get_summary_stats_by_actorTool(cfg), + tools_repos.CreateRepos_generate_release_notesTool(cfg), + tools_actions.CreateActions_list_repo_variablesTool(cfg), + tools_actions.CreateActions_create_repo_variableTool(cfg), + tools_repos.CreateRepos_disable_private_vulnerability_reportingTool(cfg), + tools_repos.CreateRepos_check_private_vulnerability_reportingTool(cfg), + tools_repos.CreateRepos_enable_private_vulnerability_reportingTool(cfg), + tools_activity.CreateActivity_delete_repo_subscriptionTool(cfg), + tools_activity.CreateActivity_get_repo_subscriptionTool(cfg), + tools_activity.CreateActivity_set_repo_subscriptionTool(cfg), + tools_orgs.CreateApi_insights_get_user_statsTool(cfg), tools_codespaces.CreateCodespaces_delete_secret_for_authenticated_userTool(cfg), tools_codespaces.CreateCodespaces_get_secret_for_authenticated_userTool(cfg), tools_codespaces.CreateCodespaces_create_or_update_secret_for_authenticated_userTool(cfg), - tools_gists.CreateGists_unstarTool(cfg), - tools_gists.CreateGists_check_is_starredTool(cfg), - tools_gists.CreateGists_starTool(cfg), - tools_repos.CreateRepos_create_commit_statusTool(cfg), - tools_repos.CreateRepos_get_pagesTool(cfg), - tools_repos.CreateRepos_create_pages_siteTool(cfg), - tools_repos.CreateRepos_update_information_about_pages_siteTool(cfg), - tools_repos.CreateRepos_delete_pages_siteTool(cfg), - tools_repos.CreateRepos_list_webhook_deliveriesTool(cfg), - tools_users.CreateUsers_unfollowTool(cfg), - tools_users.CreateUsers_check_person_is_followed_by_authenticatedTool(cfg), - tools_users.CreateUsers_followTool(cfg), - tools_billing.CreateBilling_get_github_actions_billing_userTool(cfg), - tools_apps.CreateApps_list_plansTool(cfg), - tools_teams.CreateTeams_list_discussion_comments_in_orgTool(cfg), - tools_teams.CreateTeams_create_discussion_comment_in_orgTool(cfg), - tools_users.CreateUsers_get_by_idTool(cfg), - tools_classroom.CreateClassroom_get_a_classroomTool(cfg), + tools_reactions.CreateReactions_list_for_commit_commentTool(cfg), + tools_reactions.CreateReactions_create_for_commit_commentTool(cfg), + tools_teams.CreateTeams_list_child_in_orgTool(cfg), + tools_repos.CreateRepos_get_readmeTool(cfg), + tools_orgs.CreateOrgs_get_org_ruleset_historyTool(cfg), + tools_actions.CreateActions_list_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), + tools_actions.CreateActions_set_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), + tools_actions.CreateActions_create_registration_token_for_orgTool(cfg), + tools_code_security.CreateCode_security_get_default_configurations_for_enterpriseTool(cfg), + tools_search.CreateSearch_issues_and_pull_requestsTool(cfg), + tools_issues.CreateIssues_remove_assigneesTool(cfg), + tools_issues.CreateIssues_add_assigneesTool(cfg), + tools_actions.CreateActions_create_workflow_dispatchTool(cfg), + tools_actions.CreateActions_list_github_hosted_runners_in_group_for_orgTool(cfg), + tools_packages.CreatePackages_list_docker_migration_conflicting_packages_for_authenticated_userTool(cfg), + tools_migrations.CreateMigrations_get_status_for_orgTool(cfg), + tools_actions.CreateActions_disable_workflowTool(cfg), + tools_code_scanning.CreateCode_scanning_get_variant_analysis_repo_taskTool(cfg), + tools_actions.CreateActions_get_github_actions_default_workflow_permissions_organizationTool(cfg), + tools_actions.CreateActions_set_github_actions_default_workflow_permissions_organizationTool(cfg), + tools_actions.CreateActions_get_workflow_run_usageTool(cfg), tools_actions.CreateActions_get_hosted_runners_limits_for_orgTool(cfg), - tools_projects.CreateProjects_list_columnsTool(cfg), - tools_projects.CreateProjects_create_columnTool(cfg), - tools_repos.CreateRepos_delete_tag_protectionTool(cfg), - tools_repos.CreateRepos_get_environmentTool(cfg), - tools_repos.CreateRepos_create_or_update_environmentTool(cfg), - tools_repos.CreateRepos_delete_an_environmentTool(cfg), - tools_actions.CreateActions_list_jobs_for_workflow_runTool(cfg), - tools_code_security.CreateCode_security_set_configuration_as_defaultTool(cfg), - tools_actions.CreateActions_get_hosted_runners_partner_images_for_orgTool(cfg), + tools_repos.CreateRepos_get_viewsTool(cfg), + tools_repos.CreateRepos_list_branchesTool(cfg), tools_dependabot.CreateDependabot_list_selected_repos_for_org_secretTool(cfg), tools_dependabot.CreateDependabot_set_selected_repos_for_org_secretTool(cfg), - tools_repos.CreateRepos_create_org_rulesetTool(cfg), - tools_repos.CreateRepos_get_org_rulesetsTool(cfg), - tools_actions.CreateActions_remove_self_hosted_runner_from_group_for_orgTool(cfg), - tools_actions.CreateActions_add_self_hosted_runner_to_group_for_orgTool(cfg), + tools_orgs.CreateOrgs_revoke_org_role_teamTool(cfg), + tools_orgs.CreateOrgs_assign_team_to_org_roleTool(cfg), + tools_repos.CreateRepos_get_code_frequency_statsTool(cfg), + tools_issues.CreateIssues_create_commentTool(cfg), + tools_issues.CreateIssues_list_commentsTool(cfg), + tools_issues.CreateIssues_check_user_can_be_assigned_to_issueTool(cfg), + tools_actions.CreateActions_download_artifactTool(cfg), + tools_repos.CreateRepos_get_branchTool(cfg), + tools_repos.CreateRepos_list_commit_comments_for_repoTool(cfg), + tools_actions.CreateActions_get_allowed_actions_organizationTool(cfg), + tools_actions.CreateActions_set_allowed_actions_organizationTool(cfg), + tools_repos.CreateRepos_disable_deployment_protection_ruleTool(cfg), + tools_repos.CreateRepos_get_custom_deployment_protection_ruleTool(cfg), + tools_apps.CreateApps_redeliver_webhook_deliveryTool(cfg), + tools_pulls.CreatePulls_create_reply_for_review_commentTool(cfg), tools_orgs.CreateOrgs_remove_security_manager_teamTool(cfg), tools_orgs.CreateOrgs_add_security_manager_teamTool(cfg), - tools_issues.CreateIssues_list_for_orgTool(cfg), - tools_git.CreateGit_get_blobTool(cfg), - tools_codespaces.CreateCodespaces_remove_selected_repo_from_org_secretTool(cfg), - tools_codespaces.CreateCodespaces_add_selected_repo_to_org_secretTool(cfg), - tools_reactions.CreateReactions_list_for_issueTool(cfg), - tools_reactions.CreateReactions_create_for_issueTool(cfg), - tools_orgs.CreateOrgs_ping_webhookTool(cfg), - tools_actions.CreateActions_generate_runner_jitconfig_for_repoTool(cfg), - tools_migrations.CreateMigrations_unlock_repo_for_orgTool(cfg), - tools_teams.CreateTeams_delete_discussion_in_orgTool(cfg), - tools_teams.CreateTeams_get_discussion_in_orgTool(cfg), - tools_teams.CreateTeams_update_discussion_in_orgTool(cfg), - tools_actions.CreateActions_list_runner_applications_for_repoTool(cfg), - tools_apps.CreateApps_create_from_manifestTool(cfg), - tools_licenses.CreateLicenses_get_for_repoTool(cfg), - tools_repos.CreateRepos_list_deploy_keysTool(cfg), - tools_repos.CreateRepos_create_deploy_keyTool(cfg), - tools_orgs.CreateOrgs_cancel_invitationTool(cfg), - tools_actions.CreateActions_delete_workflow_run_logsTool(cfg), - tools_actions.CreateActions_download_workflow_run_logsTool(cfg), - tools_users.CreateUsers_list_followers_for_userTool(cfg), + tools_repos.CreateRepos_delete_webhookTool(cfg), + tools_repos.CreateRepos_get_webhookTool(cfg), + tools_repos.CreateRepos_update_webhookTool(cfg), + tools_classroom.CreateClassroom_get_an_assignmentTool(cfg), + tools_actions.CreateActions_get_actions_cache_usageTool(cfg), + tools_billing.CreateBilling_get_github_actions_billing_orgTool(cfg), + tools_users.CreateUsers_list_public_emails_for_authenticated_userTool(cfg), + tools_actions.CreateActions_get_allowed_actions_repositoryTool(cfg), + tools_actions.CreateActions_set_allowed_actions_repositoryTool(cfg), + tools_repos.CreateRepos_delete_deployment_branch_policyTool(cfg), + tools_repos.CreateRepos_get_deployment_branch_policyTool(cfg), + tools_repos.CreateRepos_update_deployment_branch_policyTool(cfg), + tools_migrations.CreateMigrations_get_status_for_authenticated_userTool(cfg), + tools_actions.CreateActions_list_repo_organization_secretsTool(cfg), + tools_issues.CreateIssues_check_user_can_be_assignedTool(cfg), + tools_security_advisories.CreateSecurity_advisories_create_forkTool(cfg), + tools_secret_scanning.CreateSecret_scanning_list_alerts_for_enterpriseTool(cfg), + tools_actions.CreateActions_delete_repo_secretTool(cfg), + tools_actions.CreateActions_get_repo_secretTool(cfg), + tools_actions.CreateActions_create_or_update_repo_secretTool(cfg), + tools_apps.CreateApps_delete_authorizationTool(cfg), + tools_codespaces.CreateCodespaces_set_codespaces_access_usersTool(cfg), + tools_codespaces.CreateCodespaces_delete_codespaces_access_usersTool(cfg), + tools_repos.CreateRepos_redeliver_webhook_deliveryTool(cfg), tools_projects.CreateProjects_list_cardsTool(cfg), tools_projects.CreateProjects_create_cardTool(cfg), - tools_secret_scanning.CreateSecret_scanning_get_alertTool(cfg), - tools_secret_scanning.CreateSecret_scanning_update_alertTool(cfg), - tools_pulls.CreatePulls_update_branchTool(cfg), - tools_repos.CreateRepos_remove_status_check_contextsTool(cfg), - tools_repos.CreateRepos_get_all_status_check_contextsTool(cfg), - tools_repos.CreateRepos_add_status_check_contextsTool(cfg), - tools_repos.CreateRepos_set_status_check_contextsTool(cfg), - tools_apps.CreateApps_list_installation_requests_for_authenticated_appTool(cfg), - tools_classroom.CreateClassroom_get_assignment_gradesTool(cfg), - tools_issues.CreateIssues_remove_assigneesTool(cfg), - tools_issues.CreateIssues_add_assigneesTool(cfg), - tools_reactions.CreateReactions_create_for_pull_request_review_commentTool(cfg), - tools_reactions.CreateReactions_list_for_pull_request_review_commentTool(cfg), - tools_packages.CreatePackages_get_all_package_versions_for_package_owned_by_userTool(cfg), - tools_actions.CreateActions_get_workflowTool(cfg), - tools_reactions.CreateReactions_create_for_team_discussion_legacyTool(cfg), - tools_reactions.CreateReactions_list_for_team_discussion_legacyTool(cfg), - tools_packages.CreatePackages_get_package_version_for_organizationTool(cfg), - tools_packages.CreatePackages_delete_package_version_for_orgTool(cfg), - tools_codespaces.CreateCodespaces_list_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_create_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_get_org_public_keyTool(cfg), - tools_orgs.CreateOrgs_delete_attestations_by_subject_digestTool(cfg), - tools_dependabot.CreateDependabot_get_alertTool(cfg), - tools_dependabot.CreateDependabot_update_alertTool(cfg), - tools_orgs.CreateOrgs_list_issue_typesTool(cfg), - tools_orgs.CreateOrgs_create_issue_typeTool(cfg), - tools_actions.CreateActions_re_run_workflow_failed_jobsTool(cfg), - tools_users.CreateUsers_check_following_for_userTool(cfg), - tools_users.CreateUsers_list_following_for_userTool(cfg), - tools_actions.CreateActions_create_registration_token_for_repoTool(cfg), - tools_code_scanning.CreateCode_scanning_get_default_setupTool(cfg), - tools_code_scanning.CreateCode_scanning_update_default_setupTool(cfg), - tools_orgs.CreateOrgs_remove_public_membership_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_check_public_membership_for_userTool(cfg), - tools_orgs.CreateOrgs_set_public_membership_for_authenticated_userTool(cfg), + tools_classroom.CreateClassroom_list_accepted_assignments_for_an_assignmentTool(cfg), + tools_users.CreateUsers_list_gpg_keys_for_authenticated_userTool(cfg), + tools_users.CreateUsers_create_gpg_key_for_authenticated_userTool(cfg), tools_orgs.CreateOrgs_get_org_ruleset_versionTool(cfg), - tools_actions.CreateActions_enable_selected_repository_github_actions_organizationTool(cfg), - tools_actions.CreateActions_disable_selected_repository_github_actions_organizationTool(cfg), - tools_repos.CreateRepos_list_commit_comments_for_repoTool(cfg), - tools_teams.CreateTeams_delete_discussion_legacyTool(cfg), - tools_teams.CreateTeams_get_discussion_legacyTool(cfg), - tools_teams.CreateTeams_update_discussion_legacyTool(cfg), - tools_meta.CreateMeta_get_zenTool(cfg), - tools_teams.CreateTeams_list_projects_in_orgTool(cfg), - tools_packages.CreatePackages_restore_package_version_for_orgTool(cfg), - tools_repos.CreateRepos_get_contributors_statsTool(cfg), - tools_code_security.CreateCode_security_get_single_configuration_for_enterpriseTool(cfg), - tools_code_security.CreateCode_security_update_enterprise_configurationTool(cfg), - tools_code_security.CreateCode_security_delete_configuration_for_enterpriseTool(cfg), - tools_actions.CreateActions_approve_workflow_runTool(cfg), - tools_private_registries.CreatePrivate_registries_delete_org_private_registryTool(cfg), - tools_private_registries.CreatePrivate_registries_get_org_private_registryTool(cfg), - tools_private_registries.CreatePrivate_registries_update_org_private_registryTool(cfg), - tools_actions.CreateActions_get_custom_oidc_sub_claim_for_repoTool(cfg), - tools_actions.CreateActions_set_custom_oidc_sub_claim_for_repoTool(cfg), - tools_dependabot.CreateDependabot_remove_selected_repo_from_org_secretTool(cfg), - tools_dependabot.CreateDependabot_add_selected_repo_to_org_secretTool(cfg), - tools_activity.CreateActivity_list_watched_repos_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_check_permissions_for_devcontainerTool(cfg), - tools_apps.CreateApps_list_plans_stubbedTool(cfg), - tools_repos.CreateRepos_list_publicTool(cfg), - tools_checks.CreateChecks_create_suiteTool(cfg), + tools_actions.CreateActions_list_selected_repos_for_org_secretTool(cfg), + tools_actions.CreateActions_set_selected_repos_for_org_secretTool(cfg), + tools_code_scanning.CreateCode_scanning_delete_codeql_databaseTool(cfg), + tools_code_scanning.CreateCode_scanning_get_codeql_databaseTool(cfg), tools_dependabot.CreateDependabot_set_repository_access_default_levelTool(cfg), - tools_migrations.CreateMigrations_get_status_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_list_devcontainers_in_repository_for_authenticated_userTool(cfg), - tools_actions.CreateActions_delete_org_secretTool(cfg), - tools_actions.CreateActions_get_org_secretTool(cfg), - tools_actions.CreateActions_create_or_update_org_secretTool(cfg), - tools_actions.CreateActions_remove_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), - tools_actions.CreateActions_add_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), - tools_orgs.CreateOrgs_list_pat_grantsTool(cfg), - tools_orgs.CreateOrgs_update_pat_accessesTool(cfg), - tools_codespaces.CreateCodespaces_create_with_pr_for_authenticated_userTool(cfg), - tools_meta.CreateMeta_get_all_versionsTool(cfg), - tools_repos.CreateRepos_transferTool(cfg), - tools_classroom.CreateClassroom_get_an_assignmentTool(cfg), - tools_repos.CreateRepos_delete_invitationTool(cfg), - tools_repos.CreateRepos_update_invitationTool(cfg), - tools_meta.CreateMeta_rootTool(cfg), - tools_activity.CreateActivity_mark_thread_as_doneTool(cfg), - tools_activity.CreateActivity_get_threadTool(cfg), - tools_activity.CreateActivity_mark_thread_as_readTool(cfg), - tools_actions.CreateActions_get_hosted_runners_platforms_for_orgTool(cfg), - tools_orgs.CreateOrgs_remove_memberTool(cfg), - tools_orgs.CreateOrgs_check_membership_for_userTool(cfg), - tools_packages.CreatePackages_get_all_package_versions_for_package_owned_by_orgTool(cfg), - tools_repos.CreateRepos_mergeTool(cfg), - tools_actions.CreateActions_list_runner_applications_for_orgTool(cfg), - tools_packages.CreatePackages_list_docker_migration_conflicting_packages_for_userTool(cfg), - tools_repos.CreateRepos_compare_commitsTool(cfg), - tools_projects.CreateProjects_list_for_orgTool(cfg), - tools_projects.CreateProjects_create_for_orgTool(cfg), - tools_packages.CreatePackages_list_docker_migration_conflicting_packages_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_list_public_membersTool(cfg), - tools_code_scanning.CreateCode_scanning_get_variant_analysisTool(cfg), - tools_checks.CreateChecks_rerequest_suiteTool(cfg), - tools_activity.CreateActivity_list_public_eventsTool(cfg), - tools_codespaces.CreateCodespaces_get_repo_public_keyTool(cfg), - tools_issues.CreateIssues_remove_labelTool(cfg), - tools_teams.CreateTeams_delete_discussion_comment_legacyTool(cfg), - tools_teams.CreateTeams_get_discussion_comment_legacyTool(cfg), - tools_teams.CreateTeams_update_discussion_comment_legacyTool(cfg), - tools_orgs.CreateOrgs_revoke_all_org_roles_teamTool(cfg), - tools_actions.CreateActions_list_repo_secretsTool(cfg), - tools_apps.CreateApps_get_subscription_plan_for_accountTool(cfg), - tools_campaigns.CreateCampaigns_get_campaign_summaryTool(cfg), - tools_campaigns.CreateCampaigns_update_campaignTool(cfg), - tools_campaigns.CreateCampaigns_delete_campaignTool(cfg), - tools_repos.CreateRepos_list_autolinksTool(cfg), - tools_repos.CreateRepos_create_autolinkTool(cfg), - tools_actions.CreateActions_delete_actions_cache_by_idTool(cfg), - tools_codespaces.CreateCodespaces_list_selected_repos_for_org_secretTool(cfg), - tools_codespaces.CreateCodespaces_set_selected_repos_for_org_secretTool(cfg), - tools_code_scanning.CreateCode_scanning_list_alerts_for_repoTool(cfg), - tools_actions.CreateActions_download_workflow_run_attempt_logsTool(cfg), - tools_users.CreateUsers_list_ssh_signing_keys_for_userTool(cfg), - tools_issues.CreateIssues_list_comments_for_repoTool(cfg), - tools_issues.CreateIssues_list_assigneesTool(cfg), - tools_gists.CreateGists_list_commentsTool(cfg), - tools_gists.CreateGists_create_commentTool(cfg), - tools_repos.CreateRepos_disable_automated_security_fixesTool(cfg), - tools_repos.CreateRepos_check_automated_security_fixesTool(cfg), - tools_repos.CreateRepos_enable_automated_security_fixesTool(cfg), - tools_users.CreateUsers_list_ssh_signing_keys_for_authenticated_userTool(cfg), - tools_users.CreateUsers_create_ssh_signing_key_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_get_pull_request_review_protectionTool(cfg), - tools_repos.CreateRepos_update_pull_request_review_protectionTool(cfg), - tools_repos.CreateRepos_delete_pull_request_review_protectionTool(cfg), - tools_apps.CreateApps_scope_tokenTool(cfg), - tools_issues.CreateIssues_reprioritize_sub_issueTool(cfg), - tools_migrations.CreateMigrations_set_lfs_preferenceTool(cfg), - tools_git.CreateGit_get_commitTool(cfg), - tools_apps.CreateApps_delete_tokenTool(cfg), - tools_apps.CreateApps_reset_tokenTool(cfg), - tools_apps.CreateApps_check_tokenTool(cfg), - tools_dependabot.CreateDependabot_list_alerts_for_repoTool(cfg), - tools_orgs.CreateApi_insights_get_summary_statsTool(cfg), - tools_repos.CreateRepos_generate_release_notesTool(cfg), - tools_gists.CreateGists_list_publicTool(cfg), - tools_activity.CreateActivity_list_received_public_events_for_userTool(cfg), - tools_users.CreateUsers_list_attestationsTool(cfg), - tools_pulls.CreatePulls_list_review_comments_for_repoTool(cfg), - tools_code_scanning.CreateCode_scanning_get_variant_analysis_repo_taskTool(cfg), - tools_repos.CreateRepos_get_latest_pages_buildTool(cfg), - tools_repos.CreateRepos_disable_deployment_protection_ruleTool(cfg), - tools_repos.CreateRepos_get_custom_deployment_protection_ruleTool(cfg), - tools_repos.CreateRepos_codeowners_errorsTool(cfg), - tools_pulls.CreatePulls_remove_requested_reviewersTool(cfg), - tools_pulls.CreatePulls_list_requested_reviewersTool(cfg), - tools_pulls.CreatePulls_request_reviewersTool(cfg), - tools_actions.CreateActions_get_hosted_runners_github_owned_images_for_orgTool(cfg), - tools_orgs.CreateOrgs_get_webhook_config_for_orgTool(cfg), - tools_orgs.CreateOrgs_update_webhook_config_for_orgTool(cfg), - tools_teams.CreateTeams_remove_project_in_orgTool(cfg), - tools_teams.CreateTeams_check_permissions_for_project_in_orgTool(cfg), - tools_teams.CreateTeams_add_or_update_project_permissions_in_orgTool(cfg), - tools_apps.CreateApps_get_by_slugTool(cfg), - tools_actions.CreateActions_get_workflow_access_to_repositoryTool(cfg), - tools_actions.CreateActions_set_workflow_access_to_repositoryTool(cfg), - tools_codespaces.CreateCodespaces_delete_codespaces_access_usersTool(cfg), - tools_codespaces.CreateCodespaces_set_codespaces_access_usersTool(cfg), - tools_orgs.CreateApi_insights_get_time_statsTool(cfg), - tools_gists.CreateGists_list_starredTool(cfg), - tools_repos.CreateRepos_create_or_update_custom_properties_valuesTool(cfg), + tools_activity.CreateActivity_delete_thread_subscriptionTool(cfg), + tools_activity.CreateActivity_get_thread_subscription_for_authenticated_userTool(cfg), + tools_activity.CreateActivity_set_thread_subscriptionTool(cfg), + tools_repos.CreateRepos_get_pages_health_checkTool(cfg), + tools_apps.CreateApps_get_repo_installationTool(cfg), tools_repos.CreateRepos_get_custom_properties_valuesTool(cfg), - tools_apps.CreateApps_delete_authorizationTool(cfg), - tools_repos.CreateRepos_delete_release_assetTool(cfg), - tools_repos.CreateRepos_get_release_assetTool(cfg), - tools_repos.CreateRepos_update_release_assetTool(cfg), - tools_repos.CreateRepos_rename_branchTool(cfg), - tools_actions.CreateActions_list_jobs_for_workflow_run_attemptTool(cfg), - tools_actions.CreateActions_get_github_actions_default_workflow_permissions_repositoryTool(cfg), - tools_actions.CreateActions_set_github_actions_default_workflow_permissions_repositoryTool(cfg), - tools_orgs.CreateOrgs_list_memberships_for_authenticated_userTool(cfg), - tools_git.CreateGit_create_blobTool(cfg), - tools_codespaces.CreateCodespaces_list_repositories_for_secret_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_set_repositories_for_secret_for_authenticated_userTool(cfg), - tools_issues.CreateIssues_list_for_authenticated_userTool(cfg), - tools_security_advisories.CreateSecurity_advisories_create_private_vulnerability_reportTool(cfg), - tools_repos.CreateRepos_list_custom_deployment_rule_integrationsTool(cfg), - tools_codespaces.CreateCodespaces_publish_for_authenticated_userTool(cfg), - tools_teams.CreateTeams_remove_project_legacyTool(cfg), - tools_teams.CreateTeams_check_permissions_for_project_legacyTool(cfg), - tools_teams.CreateTeams_add_or_update_project_permissions_legacyTool(cfg), - tools_repos.CreateRepos_get_repo_rule_suitesTool(cfg), - tools_orgs.CreateOrgs_get_membership_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_update_membership_for_authenticated_userTool(cfg), - tools_issues.CreateIssues_remove_all_labelsTool(cfg), - tools_issues.CreateIssues_list_labels_on_issueTool(cfg), - tools_issues.CreateIssues_add_labelsTool(cfg), - tools_issues.CreateIssues_set_labelsTool(cfg), - tools_code_scanning.CreateCode_scanning_commit_autofixTool(cfg), - tools_codespaces.CreateCodespaces_delete_repo_secretTool(cfg), - tools_codespaces.CreateCodespaces_get_repo_secretTool(cfg), - tools_codespaces.CreateCodespaces_create_or_update_repo_secretTool(cfg), - tools_orgs.CreateOrgs_list_security_manager_teamsTool(cfg), - tools_code_scanning.CreateCode_scanning_list_alerts_for_orgTool(cfg), - tools_issues.CreateIssues_delete_labelTool(cfg), - tools_issues.CreateIssues_get_labelTool(cfg), - tools_issues.CreateIssues_update_labelTool(cfg), - tools_activity.CreateActivity_list_stargazers_for_repoTool(cfg), - tools_billing.CreateBilling_get_github_packages_billing_orgTool(cfg), - tools_repos.CreateRepos_get_org_rule_suiteTool(cfg), - tools_credentials.CreateCredentials_revokeTool(cfg), - tools_users.CreateUsers_delete_gpg_key_for_authenticated_userTool(cfg), - tools_users.CreateUsers_get_gpg_key_for_authenticated_userTool(cfg), - tools_copilot.CreateCopilot_copilot_metrics_for_organizationTool(cfg), - tools_apps.CreateApps_get_webhook_deliveryTool(cfg), - tools_secret_scanning.CreateSecret_scanning_list_alerts_for_enterpriseTool(cfg), - tools_actions.CreateActions_re_run_workflowTool(cfg), - tools_emojis.CreateEmojis_getTool(cfg), - tools_activity.CreateActivity_list_repo_notifications_for_authenticated_userTool(cfg), - tools_activity.CreateActivity_mark_repo_notifications_as_readTool(cfg), - tools_secret_scanning.CreateSecret_scanning_create_push_protection_bypassTool(cfg), + tools_repos.CreateRepos_create_or_update_custom_properties_valuesTool(cfg), + tools_repos.CreateRepos_download_tarball_archiveTool(cfg), + tools_teams.CreateTeams_remove_repo_in_orgTool(cfg), + tools_teams.CreateTeams_check_permissions_for_repo_in_orgTool(cfg), + tools_teams.CreateTeams_add_or_update_repo_permissions_in_orgTool(cfg), + tools_repos.CreateRepos_get_combined_status_for_refTool(cfg), + tools_actions.CreateActions_get_github_actions_permissions_repositoryTool(cfg), + tools_actions.CreateActions_set_github_actions_permissions_repositoryTool(cfg), + tools_actions.CreateActions_get_workflowTool(cfg), + tools_projects.CreateProjects_create_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_list_for_userTool(cfg), + tools_activity.CreateActivity_list_repos_starred_by_userTool(cfg), + tools_packages.CreatePackages_restore_package_version_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_delete_attestations_by_subject_digestTool(cfg), + tools_apps.CreateApps_list_plans_stubbedTool(cfg), + tools_orgs.CreateOrgs_list_invitation_teamsTool(cfg), + tools_repos.CreateRepos_list_pages_buildsTool(cfg), + tools_repos.CreateRepos_request_pages_buildTool(cfg), tools_copilot.CreateCopilot_get_copilot_organization_detailsTool(cfg), - tools_repos.CreateRepos_list_invitationsTool(cfg), - tools_repos.CreateRepos_disable_vulnerability_alertsTool(cfg), - tools_repos.CreateRepos_check_vulnerability_alertsTool(cfg), - tools_repos.CreateRepos_enable_vulnerability_alertsTool(cfg), - tools_code_scanning.CreateCode_scanning_get_codeql_databaseTool(cfg), - tools_code_scanning.CreateCode_scanning_delete_codeql_databaseTool(cfg), - tools_git.CreateGit_get_treeTool(cfg), - tools_reactions.CreateReactions_delete_for_pull_request_commentTool(cfg), - tools_reactions.CreateReactions_list_for_releaseTool(cfg), - tools_reactions.CreateReactions_create_for_releaseTool(cfg), - tools_packages.CreatePackages_restore_package_for_userTool(cfg), - tools_repos.CreateRepos_list_commit_statuses_for_refTool(cfg), - tools_actions.CreateActions_review_pending_deployments_for_runTool(cfg), - tools_actions.CreateActions_get_pending_deployments_for_runTool(cfg), - tools_issues.CreateIssues_list_commentsTool(cfg), - tools_issues.CreateIssues_create_commentTool(cfg), - tools_actions.CreateActions_delete_hosted_runner_for_orgTool(cfg), - tools_actions.CreateActions_get_hosted_runner_for_orgTool(cfg), - tools_actions.CreateActions_update_hosted_runner_for_orgTool(cfg), - tools_code_security.CreateCode_security_get_configuration_for_repositoryTool(cfg), - tools_teams.CreateTeams_list_discussions_in_orgTool(cfg), - tools_teams.CreateTeams_create_discussion_in_orgTool(cfg), - tools_repos.CreateRepos_list_comments_for_commitTool(cfg), - tools_repos.CreateRepos_create_commit_commentTool(cfg), - tools_actions.CreateActions_list_workflow_run_artifactsTool(cfg), - tools_reactions.CreateReactions_create_for_team_discussion_comment_in_orgTool(cfg), tools_reactions.CreateReactions_list_for_team_discussion_comment_in_orgTool(cfg), - tools_security_advisories.CreateSecurity_advisories_list_repository_advisoriesTool(cfg), - tools_security_advisories.CreateSecurity_advisories_create_repository_advisoryTool(cfg), - tools_packages.CreatePackages_delete_package_version_for_userTool(cfg), - tools_packages.CreatePackages_get_package_version_for_userTool(cfg), - tools_reactions.CreateReactions_delete_for_commit_commentTool(cfg), - tools_projects.CreateProjects_create_for_authenticated_userTool(cfg), - tools_pulls.CreatePulls_list_review_commentsTool(cfg), - tools_pulls.CreatePulls_create_review_commentTool(cfg), - tools_apps.CreateApps_remove_repo_from_installation_for_authenticated_userTool(cfg), - tools_apps.CreateApps_add_repo_to_installation_for_authenticated_userTool(cfg), - tools_actions.CreateActions_list_environment_variablesTool(cfg), - tools_actions.CreateActions_create_environment_variableTool(cfg), - tools_actions.CreateActions_list_self_hosted_runners_in_group_for_orgTool(cfg), - tools_actions.CreateActions_set_self_hosted_runners_in_group_for_orgTool(cfg), - tools_packages.CreatePackages_list_docker_migration_conflicting_packages_for_organizationTool(cfg), - tools_packages.CreatePackages_delete_package_for_userTool(cfg), - tools_packages.CreatePackages_get_package_for_userTool(cfg), - tools_secret_scanning.CreateSecret_scanning_list_alerts_for_orgTool(cfg), - tools_gists.CreateGists_delete_commentTool(cfg), - tools_gists.CreateGists_get_commentTool(cfg), - tools_gists.CreateGists_update_commentTool(cfg), - tools_teams.CreateTeams_list_discussion_comments_legacyTool(cfg), - tools_teams.CreateTeams_create_discussion_comment_legacyTool(cfg), - tools_billing.CreateBilling_get_github_actions_billing_orgTool(cfg), - tools_actions.CreateActions_list_org_secretsTool(cfg), - tools_codespaces.CreateCodespaces_remove_repository_for_secret_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_add_repository_for_secret_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_list_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_create_for_authenticated_userTool(cfg), - tools_hosted_compute.CreateHosted_compute_create_network_configuration_for_orgTool(cfg), - tools_hosted_compute.CreateHosted_compute_list_network_configurations_for_orgTool(cfg), - tools_projects.CreateProjects_move_columnTool(cfg), - tools_orgs.CreateOrgs_review_pat_grant_requestTool(cfg), - tools_security_advisories.CreateSecurity_advisories_get_global_advisoryTool(cfg), - tools_codes_of_conduct.CreateCodes_of_conduct_get_conduct_codeTool(cfg), - tools_copilot.CreateCopilot_get_copilot_seat_details_for_userTool(cfg), - tools_activity.CreateActivity_delete_repo_subscriptionTool(cfg), - tools_activity.CreateActivity_get_repo_subscriptionTool(cfg), - tools_activity.CreateActivity_set_repo_subscriptionTool(cfg), - tools_codespaces.CreateCodespaces_list_in_organizationTool(cfg), - tools_issues.CreateIssues_listTool(cfg), - tools_teams.CreateTeams_list_members_legacyTool(cfg), - tools_migrations.CreateMigrations_get_large_filesTool(cfg), + tools_reactions.CreateReactions_create_for_team_discussion_comment_in_orgTool(cfg), + tools_teams.CreateTeams_list_pending_invitations_legacyTool(cfg), + tools_actions.CreateActions_get_environment_public_keyTool(cfg), + tools_migrations.CreateMigrations_list_repos_for_orgTool(cfg), tools_users.CreateUsers_list_public_ssh_keys_for_authenticated_userTool(cfg), tools_users.CreateUsers_create_public_ssh_key_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_create_webhookTool(cfg), - tools_repos.CreateRepos_list_webhooksTool(cfg), - tools_actions.CreateActions_remove_custom_label_from_self_hosted_runner_for_repoTool(cfg), - tools_repos.CreateRepos_list_branches_for_head_commitTool(cfg), - tools_packages.CreatePackages_get_all_package_versions_for_package_owned_by_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_list_pat_grant_requestsTool(cfg), - tools_orgs.CreateOrgs_review_pat_grant_requests_in_bulkTool(cfg), - tools_pulls.CreatePulls_delete_pending_reviewTool(cfg), - tools_pulls.CreatePulls_get_reviewTool(cfg), - tools_pulls.CreatePulls_update_reviewTool(cfg), - tools_reactions.CreateReactions_list_for_team_discussion_in_orgTool(cfg), - tools_reactions.CreateReactions_create_for_team_discussion_in_orgTool(cfg), - tools_code_security.CreateCode_security_get_configurations_for_orgTool(cfg), - tools_code_security.CreateCode_security_create_configurationTool(cfg), - tools_orgs.CreateApi_insights_get_time_stats_by_userTool(cfg), - tools_private_registries.CreatePrivate_registries_get_org_public_keyTool(cfg), - tools_actions.CreateActions_list_workflow_runs_for_repoTool(cfg), - tools_repos.CreateRepos_delete_webhookTool(cfg), - tools_repos.CreateRepos_get_webhookTool(cfg), - tools_repos.CreateRepos_update_webhookTool(cfg), - tools_activity.CreateActivity_star_repo_for_authenticated_userTool(cfg), - tools_activity.CreateActivity_unstar_repo_for_authenticated_userTool(cfg), - tools_activity.CreateActivity_check_repo_is_starred_by_authenticated_userTool(cfg), - tools_git.CreateGit_delete_refTool(cfg), - tools_git.CreateGit_update_refTool(cfg), - tools_dependabot.CreateDependabot_get_org_public_keyTool(cfg), - tools_actions.CreateActions_get_allowed_actions_organizationTool(cfg), - tools_actions.CreateActions_set_allowed_actions_organizationTool(cfg), - tools_orgs.CreateApi_insights_get_summary_stats_by_actorTool(cfg), - tools_repos.CreateRepos_decline_invitation_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_accept_invitation_for_authenticated_userTool(cfg), - tools_issues.CreateIssues_remove_sub_issueTool(cfg), - tools_apps.CreateApps_list_installation_repos_for_authenticated_userTool(cfg), - tools_packages.CreatePackages_list_packages_for_userTool(cfg), - tools_hosted_compute.CreateHosted_compute_delete_network_configuration_from_orgTool(cfg), - tools_hosted_compute.CreateHosted_compute_get_network_configuration_for_orgTool(cfg), - tools_hosted_compute.CreateHosted_compute_update_network_configuration_for_orgTool(cfg), - tools_orgs.CreateOrgs_list_org_role_teamsTool(cfg), - tools_teams.CreateTeams_remove_repo_in_orgTool(cfg), - tools_teams.CreateTeams_check_permissions_for_repo_in_orgTool(cfg), - tools_teams.CreateTeams_add_or_update_repo_permissions_in_orgTool(cfg), - tools_users.CreateUsers_list_gpg_keys_for_authenticated_userTool(cfg), - tools_users.CreateUsers_create_gpg_key_for_authenticated_userTool(cfg), - tools_actions.CreateActions_get_reviews_for_runTool(cfg), - tools_billing.CreateBilling_get_github_billing_usage_report_orgTool(cfg), - tools_repos.CreateRepos_get_pages_health_checkTool(cfg), - tools_copilot.CreateCopilot_list_copilot_seatsTool(cfg), + tools_actions.CreateActions_update_hosted_runner_for_orgTool(cfg), + tools_actions.CreateActions_delete_hosted_runner_for_orgTool(cfg), + tools_actions.CreateActions_get_hosted_runner_for_orgTool(cfg), + tools_issues.CreateIssues_list_labels_for_milestoneTool(cfg), + tools_issues.CreateIssues_list_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_create_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_list_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_transferTool(cfg), + tools_security_advisories.CreateSecurity_advisories_list_global_advisoriesTool(cfg), + tools_repos.CreateRepos_get_repo_rulesetsTool(cfg), + tools_repos.CreateRepos_create_repo_rulesetTool(cfg), + tools_code_security.CreateCode_security_get_repositories_for_configurationTool(cfg), + tools_actions.CreateActions_list_repo_workflowsTool(cfg), + tools_orgs.CreateOrgs_list_membersTool(cfg), + tools_codes_of_conduct.CreateCodes_of_conduct_get_conduct_codeTool(cfg), + tools_users.CreateUsers_get_by_usernameTool(cfg), + tools_reactions.CreateReactions_list_for_issueTool(cfg), + tools_reactions.CreateReactions_create_for_issueTool(cfg), + tools_users.CreateUsers_list_following_for_userTool(cfg), + tools_orgs.CreateOrgs_delete_issue_typeTool(cfg), + tools_orgs.CreateOrgs_update_issue_typeTool(cfg), + tools_dependency_graph.CreateDependency_graph_diff_rangeTool(cfg), + tools_repos.CreateRepos_get_deployment_statusTool(cfg), + tools_orgs.CreateOrgs_remove_public_membership_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_check_public_membership_for_userTool(cfg), + tools_orgs.CreateOrgs_set_public_membership_for_authenticated_userTool(cfg), + tools_actions.CreateActions_delete_environment_secretTool(cfg), + tools_actions.CreateActions_get_environment_secretTool(cfg), + tools_actions.CreateActions_create_or_update_environment_secretTool(cfg), + tools_git.CreateGit_get_commitTool(cfg), + tools_actions.CreateActions_remove_self_hosted_runner_from_group_for_orgTool(cfg), + tools_actions.CreateActions_add_self_hosted_runner_to_group_for_orgTool(cfg), + tools_projects.CreateProjects_remove_collaboratorTool(cfg), + tools_projects.CreateProjects_add_collaboratorTool(cfg), + tools_gists.CreateGists_list_for_userTool(cfg), + tools_actions.CreateActions_get_org_public_keyTool(cfg), + tools_meta.CreateMeta_rootTool(cfg), + tools_reactions.CreateReactions_delete_for_releaseTool(cfg), + tools_actions.CreateActions_delete_workflow_run_logsTool(cfg), + tools_actions.CreateActions_download_workflow_run_logsTool(cfg), tools_reactions.CreateReactions_list_for_issue_commentTool(cfg), tools_reactions.CreateReactions_create_for_issue_commentTool(cfg), - tools_actions.CreateActions_list_selected_repos_for_org_variableTool(cfg), - tools_actions.CreateActions_set_selected_repos_for_org_variableTool(cfg), - tools_projects.CreateProjects_get_permission_for_userTool(cfg), - tools_search.CreateSearch_commitsTool(cfg), - tools_checks.CreateChecks_list_suites_for_refTool(cfg), - tools_codespaces.CreateCodespaces_stop_in_organizationTool(cfg), - tools_repos.CreateRepos_delete_access_restrictionsTool(cfg), - tools_repos.CreateRepos_get_access_restrictionsTool(cfg), - tools_actions.CreateActions_force_cancel_workflow_runTool(cfg), - tools_repos.CreateRepos_replace_all_topicsTool(cfg), - tools_repos.CreateRepos_get_all_topicsTool(cfg), - tools_codes_of_conduct.CreateCodes_of_conduct_get_all_codes_of_conductTool(cfg), - tools_teams.CreateTeams_list_repos_legacyTool(cfg), - tools_repos.CreateRepos_disable_private_vulnerability_reportingTool(cfg), - tools_repos.CreateRepos_check_private_vulnerability_reportingTool(cfg), - tools_repos.CreateRepos_enable_private_vulnerability_reportingTool(cfg), - tools_actions.CreateActions_enable_workflowTool(cfg), - tools_packages.CreatePackages_delete_package_version_for_authenticated_userTool(cfg), - tools_packages.CreatePackages_get_package_version_for_authenticated_userTool(cfg), - tools_code_scanning.CreateCode_scanning_get_sarifTool(cfg), - tools_meta.CreateMeta_getTool(cfg), - tools_issues.CreateIssues_list_labels_for_repoTool(cfg), - tools_issues.CreateIssues_create_labelTool(cfg), - tools_dependabot.CreateDependabot_get_repo_public_keyTool(cfg), - tools_code_scanning.CreateCode_scanning_list_recent_analysesTool(cfg), - tools_orgs.CreateOrgs_revoke_org_role_teamTool(cfg), - tools_orgs.CreateOrgs_assign_team_to_org_roleTool(cfg), - tools_orgs.CreateOrgs_list_pat_grant_repositoriesTool(cfg), - tools_reactions.CreateReactions_delete_for_releaseTool(cfg), - tools_users.CreateUsers_get_by_usernameTool(cfg), - tools_actions.CreateActions_get_workflow_run_attemptTool(cfg), - tools_packages.CreatePackages_list_packages_for_organizationTool(cfg), - tools_repos.CreateRepos_get_org_rule_suitesTool(cfg), tools_actions.CreateActions_delete_repo_variableTool(cfg), tools_actions.CreateActions_get_repo_variableTool(cfg), tools_actions.CreateActions_update_repo_variableTool(cfg), - tools_codespaces.CreateCodespaces_get_codespaces_for_user_in_orgTool(cfg), - tools_gists.CreateGists_listTool(cfg), - tools_gists.CreateGists_createTool(cfg), - tools_repos.CreateRepos_get_viewsTool(cfg), - tools_actions.CreateActions_list_selected_repositories_enabled_github_actions_organizationTool(cfg), - tools_actions.CreateActions_set_selected_repositories_enabled_github_actions_organizationTool(cfg), - tools_checks.CreateChecks_getTool(cfg), - tools_checks.CreateChecks_updateTool(cfg), - tools_repos.CreateRepos_get_clonesTool(cfg), - tools_orgs.CreateOrgs_list_for_userTool(cfg), - tools_orgs.CreateOrgs_list_pending_invitationsTool(cfg), - tools_orgs.CreateOrgs_create_invitationTool(cfg), - tools_issues.CreateIssues_delete_commentTool(cfg), - tools_issues.CreateIssues_get_commentTool(cfg), - tools_issues.CreateIssues_update_commentTool(cfg), - tools_actions.CreateActions_delete_repo_secretTool(cfg), - tools_actions.CreateActions_get_repo_secretTool(cfg), - tools_actions.CreateActions_create_or_update_repo_secretTool(cfg), - tools_teams.CreateTeams_list_members_in_orgTool(cfg), - tools_apps.CreateApps_list_installationsTool(cfg), - tools_gists.CreateGists_forkTool(cfg), + tools_repos.CreateRepos_get_pages_deploymentTool(cfg), + tools_orgs.CreateOrgs_listTool(cfg), + tools_security_advisories.CreateSecurity_advisories_create_repository_advisory_cve_requestTool(cfg), + tools_actions.CreateActions_approve_workflow_runTool(cfg), + tools_repos.CreateRepos_get_top_pathsTool(cfg), + tools_git.CreateGit_get_tagTool(cfg), + tools_repos.CreateRepos_list_languagesTool(cfg), + tools_dependabot.CreateDependabot_update_repository_access_for_orgTool(cfg), + tools_dependabot.CreateDependabot_repository_access_for_orgTool(cfg), + tools_repos.CreateRepos_update_org_rulesetTool(cfg), + tools_repos.CreateRepos_delete_org_rulesetTool(cfg), + tools_repos.CreateRepos_get_org_rulesetTool(cfg), + tools_reactions.CreateReactions_delete_for_team_discussionTool(cfg), + tools_actions.CreateActions_remove_custom_label_from_self_hosted_runner_for_orgTool(cfg), + tools_orgs.CreateOrgs_get_all_custom_propertiesTool(cfg), + tools_orgs.CreateOrgs_create_or_update_custom_propertiesTool(cfg), + tools_users.CreateUsers_delete_gpg_key_for_authenticated_userTool(cfg), + tools_users.CreateUsers_get_gpg_key_for_authenticated_userTool(cfg), + tools_issues.CreateIssues_remove_all_labelsTool(cfg), + tools_issues.CreateIssues_list_labels_on_issueTool(cfg), + tools_issues.CreateIssues_add_labelsTool(cfg), + tools_issues.CreateIssues_set_labelsTool(cfg), + tools_search.CreateSearch_usersTool(cfg), + tools_issues.CreateIssues_listTool(cfg), + tools_apps.CreateApps_list_subscriptions_for_authenticated_user_stubbedTool(cfg), + tools_repos.CreateRepos_get_all_deployment_protection_rulesTool(cfg), + tools_repos.CreateRepos_create_deployment_protection_ruleTool(cfg), + tools_apps.CreateApps_get_installationTool(cfg), + tools_apps.CreateApps_delete_installationTool(cfg), + tools_repos.CreateRepos_delete_access_restrictionsTool(cfg), + tools_repos.CreateRepos_get_access_restrictionsTool(cfg), + tools_actions.CreateActions_list_workflow_runs_for_repoTool(cfg), + tools_users.CreateUsers_delete_public_ssh_key_for_authenticated_userTool(cfg), + tools_users.CreateUsers_get_public_ssh_key_for_authenticated_userTool(cfg), + tools_billing.CreateBilling_get_shared_storage_billing_userTool(cfg), tools_gists.CreateGists_list_forksTool(cfg), - tools_activity.CreateActivity_list_repos_starred_by_authenticated_userTool(cfg), + tools_gists.CreateGists_forkTool(cfg), + tools_orgs.CreateOrgs_delete_attestations_bulkTool(cfg), + tools_actions.CreateActions_get_actions_cache_usage_by_repo_for_orgTool(cfg), + tools_repos.CreateRepos_delete_repo_rulesetTool(cfg), + tools_repos.CreateRepos_get_repo_rulesetTool(cfg), + tools_repos.CreateRepos_update_repo_rulesetTool(cfg), + tools_actions.CreateActions_set_custom_labels_for_self_hosted_runner_for_orgTool(cfg), + tools_actions.CreateActions_remove_all_custom_labels_from_self_hosted_runner_for_orgTool(cfg), + tools_actions.CreateActions_list_labels_for_self_hosted_runner_for_orgTool(cfg), + tools_actions.CreateActions_add_custom_labels_to_self_hosted_runner_for_orgTool(cfg), + tools_apps.CreateApps_delete_tokenTool(cfg), + tools_apps.CreateApps_reset_tokenTool(cfg), + tools_apps.CreateApps_check_tokenTool(cfg), + tools_code_security.CreateCode_security_get_repositories_for_enterprise_configurationTool(cfg), + tools_orgs.CreateOrgs_list_custom_properties_values_for_reposTool(cfg), + tools_orgs.CreateOrgs_create_or_update_custom_properties_values_for_reposTool(cfg), + tools_apps.CreateApps_list_installation_repos_for_authenticated_userTool(cfg), + tools_actions.CreateActions_list_jobs_for_workflow_run_attemptTool(cfg), + tools_pulls.CreatePulls_list_filesTool(cfg), + tools_actions.CreateActions_re_run_job_for_workflow_runTool(cfg), + tools_dependabot.CreateDependabot_list_alerts_for_repoTool(cfg), + tools_issues.CreateIssues_remove_sub_issueTool(cfg), + tools_orgs.CreateOrgs_revoke_org_role_userTool(cfg), + tools_orgs.CreateOrgs_assign_user_to_org_roleTool(cfg), + tools_activity.CreateActivity_list_stargazers_for_repoTool(cfg), + tools_repos.CreateRepos_remove_status_check_contextsTool(cfg), + tools_repos.CreateRepos_get_all_status_check_contextsTool(cfg), + tools_repos.CreateRepos_add_status_check_contextsTool(cfg), + tools_repos.CreateRepos_set_status_check_contextsTool(cfg), + tools_repos.CreateRepos_codeowners_errorsTool(cfg), + tools_repos.CreateRepos_get_latest_releaseTool(cfg), + tools_apps.CreateApps_get_subscription_plan_for_account_stubbedTool(cfg), + tools_actions.CreateActions_remove_selected_repo_from_org_secretTool(cfg), + tools_actions.CreateActions_add_selected_repo_to_org_secretTool(cfg), + tools_secret_scanning.CreateSecret_scanning_list_alerts_for_orgTool(cfg), + tools_codespaces.CreateCodespaces_list_repositories_for_secret_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_set_repositories_for_secret_for_authenticated_userTool(cfg), + tools_gists.CreateGists_delete_commentTool(cfg), + tools_gists.CreateGists_get_commentTool(cfg), + tools_gists.CreateGists_update_commentTool(cfg), + tools_users.CreateUsers_listTool(cfg), + tools_orgs.CreateApi_insights_get_subject_statsTool(cfg), + tools_pulls.CreatePulls_check_if_mergedTool(cfg), + tools_pulls.CreatePulls_mergeTool(cfg), + tools_codespaces.CreateCodespaces_list_org_secretsTool(cfg), + tools_users.CreateUsers_list_followers_for_authenticated_userTool(cfg), + tools_search.CreateSearch_commitsTool(cfg), + tools_repos.CreateRepos_create_using_templateTool(cfg), + tools_checks.CreateChecks_updateTool(cfg), + tools_checks.CreateChecks_getTool(cfg), + tools_orgs.CreateOrgs_cancel_invitationTool(cfg), + tools_dependabot.CreateDependabot_delete_repo_secretTool(cfg), + tools_dependabot.CreateDependabot_get_repo_secretTool(cfg), + tools_dependabot.CreateDependabot_create_or_update_repo_secretTool(cfg), + tools_meta.CreateMeta_get_zenTool(cfg), + tools_teams.CreateTeams_list_discussion_comments_in_orgTool(cfg), + tools_teams.CreateTeams_create_discussion_comment_in_orgTool(cfg), + tools_actions.CreateActions_list_self_hosted_runners_for_repoTool(cfg), + tools_repos.CreateRepos_get_latest_pages_buildTool(cfg), + tools_codespaces.CreateCodespaces_create_with_pr_for_authenticated_userTool(cfg), + tools_git.CreateGit_get_refTool(cfg), + tools_git.CreateGit_get_treeTool(cfg), + tools_repos.CreateRepos_list_forksTool(cfg), + tools_repos.CreateRepos_create_forkTool(cfg), + tools_issues.CreateIssues_delete_milestoneTool(cfg), + tools_issues.CreateIssues_get_milestoneTool(cfg), + tools_issues.CreateIssues_update_milestoneTool(cfg), + tools_security_advisories.CreateSecurity_advisories_list_org_repository_advisoriesTool(cfg), + tools_migrations.CreateMigrations_list_repos_for_authenticated_userTool(cfg), + tools_checks.CreateChecks_get_suiteTool(cfg), + tools_code_scanning.CreateCode_scanning_commit_autofixTool(cfg), + tools_gists.CreateGists_list_commentsTool(cfg), + tools_gists.CreateGists_create_commentTool(cfg), + tools_pulls.CreatePulls_list_commitsTool(cfg), + tools_repos.CreateRepos_list_deployment_branch_policiesTool(cfg), + tools_repos.CreateRepos_create_deployment_branch_policyTool(cfg), + tools_repos.CreateRepos_list_releasesTool(cfg), + tools_repos.CreateRepos_create_releaseTool(cfg), + tools_classroom.CreateClassroom_list_assignments_for_a_classroomTool(cfg), + tools_actions.CreateActions_list_repo_secretsTool(cfg), + tools_repos.CreateRepos_get_branch_rulesTool(cfg), + tools_credentials.CreateCredentials_revokeTool(cfg), + tools_repos.CreateRepos_get_collaborator_permission_levelTool(cfg), + tools_code_scanning.CreateCode_scanning_delete_analysisTool(cfg), + tools_code_scanning.CreateCode_scanning_get_analysisTool(cfg), + tools_code_security.CreateCode_security_set_configuration_as_defaultTool(cfg), + tools_search.CreateSearch_labelsTool(cfg), + tools_users.CreateUsers_unfollowTool(cfg), + tools_users.CreateUsers_check_person_is_followed_by_authenticatedTool(cfg), + tools_users.CreateUsers_followTool(cfg), + tools_teams.CreateTeams_list_discussions_in_orgTool(cfg), + tools_teams.CreateTeams_create_discussion_in_orgTool(cfg), + tools_activity.CreateActivity_list_public_events_for_repo_networkTool(cfg), + tools_codespaces.CreateCodespaces_get_repo_public_keyTool(cfg), + tools_issues.CreateIssues_remove_labelTool(cfg), + tools_pulls.CreatePulls_delete_review_commentTool(cfg), + tools_pulls.CreatePulls_get_review_commentTool(cfg), + tools_pulls.CreatePulls_update_review_commentTool(cfg), + tools_issues.CreateIssues_list_events_for_repoTool(cfg), + tools_actions.CreateActions_create_registration_token_for_repoTool(cfg), + tools_dependency_graph.CreateDependency_graph_export_sbomTool(cfg), + tools_packages.CreatePackages_restore_package_for_userTool(cfg), + tools_codespaces.CreateCodespaces_start_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_list_comments_for_commitTool(cfg), + tools_repos.CreateRepos_create_commit_commentTool(cfg), + tools_pulls.CreatePulls_request_reviewersTool(cfg), + tools_pulls.CreatePulls_remove_requested_reviewersTool(cfg), + tools_pulls.CreatePulls_list_requested_reviewersTool(cfg), + tools_orgs.CreateOrgs_list_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_publish_for_authenticated_userTool(cfg), tools_apps.CreateApps_unsuspend_installationTool(cfg), tools_apps.CreateApps_suspend_installationTool(cfg), - tools_repos.CreateRepos_list_pull_requests_associated_with_commitTool(cfg), - tools_pulls.CreatePulls_getTool(cfg), - tools_pulls.CreatePulls_updateTool(cfg), - tools_actions.CreateActions_list_repo_workflowsTool(cfg), - tools_actions.CreateActions_list_artifacts_for_repoTool(cfg), - tools_actions.CreateActions_get_actions_cache_usage_for_orgTool(cfg), - tools_orgs.CreateOrgs_list_attestationsTool(cfg), - tools_actions.CreateActions_get_actions_cache_usageTool(cfg), - tools_code_security.CreateCode_security_get_configurations_for_enterpriseTool(cfg), - tools_code_security.CreateCode_security_create_configuration_for_enterpriseTool(cfg), - tools_repos.CreateRepos_create_attestationTool(cfg), - tools_repos.CreateRepos_create_tag_protectionTool(cfg), - tools_repos.CreateRepos_list_tag_protectionTool(cfg), - tools_actions.CreateActions_list_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), - tools_actions.CreateActions_set_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), - tools_checks.CreateChecks_list_annotationsTool(cfg), - tools_teams.CreateTeams_list_projects_legacyTool(cfg), - tools_repos.CreateRepos_get_top_pathsTool(cfg), - tools_interactions.CreateInteractions_remove_restrictions_for_orgTool(cfg), - tools_interactions.CreateInteractions_get_restrictions_for_orgTool(cfg), - tools_interactions.CreateInteractions_set_restrictions_for_orgTool(cfg), - tools_actions.CreateActions_list_org_variablesTool(cfg), - tools_actions.CreateActions_create_org_variableTool(cfg), - tools_actions.CreateActions_generate_runner_jitconfig_for_orgTool(cfg), - tools_actions.CreateActions_create_workflow_dispatchTool(cfg), - tools_repos.CreateRepos_list_contributorsTool(cfg), - tools_teams.CreateTeams_listTool(cfg), - tools_teams.CreateTeams_createTool(cfg), + tools_users.CreateUsers_set_primary_email_visibility_for_authenticated_userTool(cfg), + tools_apps.CreateApps_create_from_manifestTool(cfg), + tools_code_scanning.CreateCode_scanning_get_variant_analysisTool(cfg), + tools_apps.CreateApps_get_org_installationTool(cfg), + tools_gists.CreateGists_check_is_starredTool(cfg), + tools_gists.CreateGists_starTool(cfg), + tools_gists.CreateGists_unstarTool(cfg), + tools_migrations.CreateMigrations_map_commit_authorTool(cfg), + tools_actions.CreateActions_remove_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), + tools_actions.CreateActions_add_repo_access_to_self_hosted_runner_group_in_orgTool(cfg), + tools_apps.CreateApps_list_webhook_deliveriesTool(cfg), + tools_dependabot.CreateDependabot_update_alertTool(cfg), + tools_dependabot.CreateDependabot_get_alertTool(cfg), + tools_search.CreateSearch_reposTool(cfg), + tools_actions.CreateActions_get_hosted_runners_github_owned_images_for_orgTool(cfg), + tools_packages.CreatePackages_get_all_package_versions_for_package_owned_by_authenticated_userTool(cfg), + tools_repos.CreateRepos_get_org_rule_suitesTool(cfg), + tools_pulls.CreatePulls_list_review_commentsTool(cfg), + tools_pulls.CreatePulls_create_review_commentTool(cfg), + tools_repos.CreateRepos_list_commit_statuses_for_refTool(cfg), + tools_repos.CreateRepos_get_pages_buildTool(cfg), + tools_repos.CreateRepos_decline_invitation_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_accept_invitation_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_get_membership_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_update_membership_for_authenticated_userTool(cfg), + tools_actions.CreateActions_delete_org_secretTool(cfg), + tools_actions.CreateActions_get_org_secretTool(cfg), + tools_actions.CreateActions_create_or_update_org_secretTool(cfg), + tools_users.CreateUsers_list_followers_for_userTool(cfg), + tools_reactions.CreateReactions_list_for_releaseTool(cfg), + tools_reactions.CreateReactions_create_for_releaseTool(cfg), + tools_hosted_compute.CreateHosted_compute_create_network_configuration_for_orgTool(cfg), + tools_hosted_compute.CreateHosted_compute_list_network_configurations_for_orgTool(cfg), + tools_activity.CreateActivity_list_public_events_for_userTool(cfg), + tools_activity.CreateActivity_list_received_events_for_userTool(cfg), + tools_repos.CreateRepos_disable_automated_security_fixesTool(cfg), + tools_repos.CreateRepos_check_automated_security_fixesTool(cfg), + tools_repos.CreateRepos_enable_automated_security_fixesTool(cfg), + tools_actions.CreateActions_list_org_secretsTool(cfg), + tools_repos.CreateRepos_list_tagsTool(cfg), + tools_repos.CreateRepos_list_commitsTool(cfg), + tools_private_registries.CreatePrivate_registries_get_org_public_keyTool(cfg), tools_issues.CreateIssues_getTool(cfg), tools_issues.CreateIssues_updateTool(cfg), + tools_codespaces.CreateCodespaces_set_selected_repos_for_org_secretTool(cfg), + tools_codespaces.CreateCodespaces_list_selected_repos_for_org_secretTool(cfg), + tools_repos.CreateRepos_get_all_environmentsTool(cfg), + tools_packages.CreatePackages_restore_package_version_for_userTool(cfg), + tools_code_scanning.CreateCode_scanning_get_sarifTool(cfg), + tools_git.CreateGit_list_matching_refsTool(cfg), + tools_apps.CreateApps_get_by_slugTool(cfg), + tools_code_scanning.CreateCode_scanning_list_recent_analysesTool(cfg), + tools_users.CreateUsers_delete_social_account_for_authenticated_userTool(cfg), + tools_users.CreateUsers_list_social_accounts_for_authenticated_userTool(cfg), + tools_users.CreateUsers_add_social_account_for_authenticated_userTool(cfg), + tools_actions.CreateActions_delete_actions_cache_by_idTool(cfg), tools_projects.CreateProjects_delete_columnTool(cfg), tools_projects.CreateProjects_get_columnTool(cfg), tools_projects.CreateProjects_update_columnTool(cfg), - tools_code_security.CreateCode_security_get_default_configurationsTool(cfg), - tools_issues.CreateIssues_get_eventTool(cfg), - tools_code_scanning.CreateCode_scanning_create_variant_analysisTool(cfg), - tools_activity.CreateActivity_list_repos_watched_by_userTool(cfg), - tools_teams.CreateTeams_list_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_list_attestationsTool(cfg), - tools_repos.CreateRepos_get_deployment_statusTool(cfg), - tools_users.CreateUsers_list_public_keys_for_userTool(cfg), - tools_actions.CreateActions_get_github_actions_permissions_organizationTool(cfg), - tools_actions.CreateActions_set_github_actions_permissions_organizationTool(cfg), - tools_actions.CreateActions_get_allowed_actions_repositoryTool(cfg), - tools_actions.CreateActions_set_allowed_actions_repositoryTool(cfg), - tools_repos.CreateRepos_ping_webhookTool(cfg), - tools_actions.CreateActions_cancel_workflow_runTool(cfg), - tools_reactions.CreateReactions_delete_for_issue_commentTool(cfg), - tools_teams.CreateTeams_list_child_in_orgTool(cfg), - tools_actions.CreateActions_get_hosted_runners_machine_specs_for_orgTool(cfg), - tools_apps.CreateApps_list_webhook_deliveriesTool(cfg), - tools_repos.CreateRepos_redeliver_webhook_deliveryTool(cfg), - tools_repos.CreateRepos_create_pages_deploymentTool(cfg), - tools_issues.CreateIssues_delete_milestoneTool(cfg), - tools_issues.CreateIssues_get_milestoneTool(cfg), - tools_issues.CreateIssues_update_milestoneTool(cfg), - tools_teams.CreateTeams_list_pending_invitations_legacyTool(cfg), - tools_actions.CreateActions_get_environment_public_keyTool(cfg), - tools_packages.CreatePackages_restore_package_version_for_userTool(cfg), - tools_orgs.CreateOrgs_remove_membership_for_userTool(cfg), - tools_orgs.CreateOrgs_get_membership_for_userTool(cfg), - tools_orgs.CreateOrgs_set_membership_for_userTool(cfg), - tools_orgs.CreateApi_insights_get_time_stats_by_actorTool(cfg), - tools_orgs.CreateOrgs_list_membersTool(cfg), - tools_apps.CreateApps_get_webhook_config_for_appTool(cfg), - tools_apps.CreateApps_update_webhook_config_for_appTool(cfg), - tools_orgs.CreateOrgs_delete_attestations_bulkTool(cfg), - tools_orgs.CreateOrgs_update_pat_accessTool(cfg), - tools_secret_scanning.CreateSecret_scanning_list_locations_for_alertTool(cfg), - tools_users.CreateUsers_list_blocked_by_authenticated_userTool(cfg), - tools_gists.CreateGists_list_for_userTool(cfg), - tools_orgs.CreateOrgs_revoke_all_org_roles_userTool(cfg), - tools_dependabot.CreateDependabot_delete_org_secretTool(cfg), - tools_dependabot.CreateDependabot_get_org_secretTool(cfg), - tools_dependabot.CreateDependabot_create_or_update_org_secretTool(cfg), - tools_migrations.CreateMigrations_list_for_orgTool(cfg), - tools_migrations.CreateMigrations_start_for_orgTool(cfg), - tools_rate_limit.CreateRate_limit_getTool(cfg), - tools_actions.CreateActions_create_registration_token_for_orgTool(cfg), - tools_actions.CreateActions_disable_workflowTool(cfg), - tools_actions.CreateActions_list_environment_secretsTool(cfg), + tools_repos.CreateRepos_disable_vulnerability_alertsTool(cfg), + tools_repos.CreateRepos_check_vulnerability_alertsTool(cfg), + tools_repos.CreateRepos_enable_vulnerability_alertsTool(cfg), + tools_users.CreateUsers_delete_ssh_signing_key_for_authenticated_userTool(cfg), + tools_users.CreateUsers_get_ssh_signing_key_for_authenticated_userTool(cfg), + tools_actions.CreateActions_disable_selected_repository_github_actions_organizationTool(cfg), + tools_actions.CreateActions_enable_selected_repository_github_actions_organizationTool(cfg), + tools_actions.CreateActions_get_hosted_runners_partner_images_for_orgTool(cfg), + tools_actions.CreateActions_add_custom_labels_to_self_hosted_runner_for_repoTool(cfg), + tools_actions.CreateActions_set_custom_labels_for_self_hosted_runner_for_repoTool(cfg), + tools_actions.CreateActions_remove_all_custom_labels_from_self_hosted_runner_for_repoTool(cfg), + tools_actions.CreateActions_list_labels_for_self_hosted_runner_for_repoTool(cfg), + tools_dependabot.CreateDependabot_list_alerts_for_enterpriseTool(cfg), + tools_activity.CreateActivity_list_repo_eventsTool(cfg), + tools_secret_scanning.CreateSecret_scanning_list_alerts_for_repoTool(cfg), + tools_orgs.CreateOrgs_list_app_installationsTool(cfg), + tools_code_scanning.CreateCode_scanning_create_variant_analysisTool(cfg), + tools_teams.CreateTeams_remove_project_legacyTool(cfg), + tools_teams.CreateTeams_check_permissions_for_project_legacyTool(cfg), + tools_teams.CreateTeams_add_or_update_project_permissions_legacyTool(cfg), + tools_checks.CreateChecks_list_annotationsTool(cfg), + tools_issues.CreateIssues_get_eventTool(cfg), + tools_teams.CreateTeams_list_discussion_comments_legacyTool(cfg), + tools_teams.CreateTeams_create_discussion_comment_legacyTool(cfg), + tools_interactions.CreateInteractions_remove_restrictions_for_repoTool(cfg), + tools_interactions.CreateInteractions_get_restrictions_for_repoTool(cfg), + tools_interactions.CreateInteractions_set_restrictions_for_repoTool(cfg), + tools_repos.CreateRepos_remove_collaboratorTool(cfg), + tools_repos.CreateRepos_check_collaboratorTool(cfg), + tools_repos.CreateRepos_add_collaboratorTool(cfg), tools_issues.CreateIssues_list_eventsTool(cfg), - tools_activity.CreateActivity_list_repos_starred_by_userTool(cfg), - tools_orgs.CreateApi_insights_get_subject_statsTool(cfg), - tools_users.CreateUsers_delete_email_for_authenticated_userTool(cfg), - tools_users.CreateUsers_list_emails_for_authenticated_userTool(cfg), - tools_users.CreateUsers_add_email_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_remove_app_access_restrictionsTool(cfg), - tools_repos.CreateRepos_get_apps_with_access_to_protected_branchTool(cfg), - tools_repos.CreateRepos_add_app_access_restrictionsTool(cfg), - tools_repos.CreateRepos_set_app_access_restrictionsTool(cfg), - tools_actions.CreateActions_delete_environment_secretTool(cfg), - tools_actions.CreateActions_get_environment_secretTool(cfg), - tools_actions.CreateActions_create_or_update_environment_secretTool(cfg), - tools_pulls.CreatePulls_check_if_mergedTool(cfg), - tools_pulls.CreatePulls_mergeTool(cfg), - tools_classroom.CreateClassroom_list_assignments_for_a_classroomTool(cfg), - tools_repos.CreateRepos_get_all_deployment_protection_rulesTool(cfg), - tools_repos.CreateRepos_create_deployment_protection_ruleTool(cfg), - tools_orgs.CreateOrgs_list_org_role_usersTool(cfg), - tools_code_scanning.CreateCode_scanning_list_alert_instancesTool(cfg), - tools_migrations.CreateMigrations_list_for_authenticated_userTool(cfg), - tools_migrations.CreateMigrations_start_for_authenticated_userTool(cfg), - tools_actions.CreateActions_list_repo_variablesTool(cfg), - tools_actions.CreateActions_create_repo_variableTool(cfg), - tools_code_security.CreateCode_security_get_repositories_for_enterprise_configurationTool(cfg), - tools_orgs.CreateOrgs_get_all_custom_propertiesTool(cfg), - tools_orgs.CreateOrgs_create_or_update_custom_propertiesTool(cfg), - tools_gitignore.CreateGitignore_get_templateTool(cfg), - tools_code_security.CreateCode_security_set_configuration_as_default_for_enterpriseTool(cfg), - tools_repos.CreateRepos_get_branchTool(cfg), - tools_teams.CreateTeams_delete_discussion_comment_in_orgTool(cfg), - tools_teams.CreateTeams_get_discussion_comment_in_orgTool(cfg), - tools_teams.CreateTeams_update_discussion_comment_in_orgTool(cfg), - tools_codespaces.CreateCodespaces_delete_from_organizationTool(cfg), + tools_codespaces.CreateCodespaces_stop_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_get_webhook_config_for_orgTool(cfg), + tools_orgs.CreateOrgs_update_webhook_config_for_orgTool(cfg), + tools_packages.CreatePackages_list_packages_for_userTool(cfg), + tools_teams.CreateTeams_list_projects_legacyTool(cfg), + tools_users.CreateUsers_delete_attestations_bulkTool(cfg), tools_teams.CreateTeams_add_or_update_membership_for_user_in_orgTool(cfg), tools_teams.CreateTeams_remove_membership_for_user_in_orgTool(cfg), tools_teams.CreateTeams_get_membership_for_user_in_orgTool(cfg), - tools_codespaces.CreateCodespaces_list_org_secretsTool(cfg), - tools_projects.CreateProjects_list_for_userTool(cfg), - tools_billing.CreateBilling_get_github_packages_billing_userTool(cfg), - tools_actions.CreateActions_list_repo_organization_variablesTool(cfg), - tools_repos.CreateRepos_get_pages_deploymentTool(cfg), - tools_licenses.CreateLicenses_get_all_commonly_usedTool(cfg), - tools_repos.CreateRepos_get_collaborator_permission_levelTool(cfg), - tools_repos.CreateRepos_get_webhook_config_for_repoTool(cfg), - tools_repos.CreateRepos_update_webhook_config_for_repoTool(cfg), - tools_users.CreateUsers_listTool(cfg), - tools_dependabot.CreateDependabot_list_org_secretsTool(cfg), - tools_checks.CreateChecks_rerequest_runTool(cfg), - tools_git.CreateGit_get_refTool(cfg), - tools_users.CreateUsers_list_attestations_bulkTool(cfg), - tools_repos.CreateRepos_remove_team_access_restrictionsTool(cfg), - tools_repos.CreateRepos_get_teams_with_access_to_protected_branchTool(cfg), - tools_repos.CreateRepos_add_team_access_restrictionsTool(cfg), - tools_repos.CreateRepos_set_team_access_restrictionsTool(cfg), - tools_users.CreateUsers_list_followed_by_authenticated_userTool(cfg), - tools_packages.CreatePackages_restore_package_version_for_authenticated_userTool(cfg), - tools_migrations.CreateMigrations_unlock_repo_for_authenticated_userTool(cfg), - tools_gists.CreateGists_deleteTool(cfg), - tools_gists.CreateGists_getTool(cfg), - tools_gists.CreateGists_updateTool(cfg), - tools_apps.CreateApps_list_subscriptions_for_authenticated_userTool(cfg), - tools_secret_scanning.CreateSecret_scanning_get_scan_historyTool(cfg), - tools_actions.CreateActions_list_repo_organization_secretsTool(cfg), - tools_teams.CreateTeams_delete_legacyTool(cfg), - tools_teams.CreateTeams_get_legacyTool(cfg), - tools_teams.CreateTeams_update_legacyTool(cfg), - tools_activity.CreateActivity_list_received_events_for_userTool(cfg), - tools_actions.CreateActions_get_actions_cache_usage_by_repo_for_orgTool(cfg), - tools_repos.CreateRepos_list_pages_buildsTool(cfg), - tools_repos.CreateRepos_request_pages_buildTool(cfg), - tools_git.CreateGit_create_treeTool(cfg), - tools_apps.CreateApps_list_subscriptions_for_authenticated_user_stubbedTool(cfg), - tools_billing.CreateBilling_get_shared_storage_billing_orgTool(cfg), - tools_repos.CreateRepos_create_forkTool(cfg), - tools_repos.CreateRepos_list_forksTool(cfg), - tools_repos.CreateRepos_get_all_environmentsTool(cfg), - tools_repos.CreateRepos_list_commitsTool(cfg), - tools_security_advisories.CreateSecurity_advisories_list_global_advisoriesTool(cfg), - tools_private_registries.CreatePrivate_registries_create_org_private_registryTool(cfg), - tools_private_registries.CreatePrivate_registries_list_org_private_registriesTool(cfg), - tools_orgs.CreateOrgs_list_for_authenticated_userTool(cfg), - tools_reactions.CreateReactions_delete_for_issueTool(cfg), - tools_reactions.CreateReactions_delete_for_team_discussion_commentTool(cfg), - tools_copilot.CreateCopilot_copilot_metrics_for_teamTool(cfg), - tools_gitignore.CreateGitignore_get_all_templatesTool(cfg), - tools_repos.CreateRepos_list_teamsTool(cfg), - tools_repos.CreateRepos_list_for_orgTool(cfg), - tools_repos.CreateRepos_create_in_orgTool(cfg), - tools_copilot.CreateCopilot_cancel_copilot_seat_assignment_for_teamsTool(cfg), - tools_copilot.CreateCopilot_add_copilot_seats_for_teamsTool(cfg), - tools_teams.CreateTeams_remove_membership_for_user_legacyTool(cfg), - tools_teams.CreateTeams_get_membership_for_user_legacyTool(cfg), - tools_teams.CreateTeams_add_or_update_membership_for_user_legacyTool(cfg), - tools_code_security.CreateCode_security_attach_enterprise_configurationTool(cfg), - tools_search.CreateSearch_issues_and_pull_requestsTool(cfg), - tools_orgs.CreateOrgs_list_blocked_usersTool(cfg), - tools_actions.CreateActions_list_self_hosted_runner_groups_for_orgTool(cfg), - tools_actions.CreateActions_create_self_hosted_runner_group_for_orgTool(cfg), - tools_activity.CreateActivity_list_watchers_for_repoTool(cfg), - tools_git.CreateGit_create_refTool(cfg), - tools_repos.CreateRepos_get_repo_ruleset_historyTool(cfg), + tools_issues.CreateIssues_delete_commentTool(cfg), + tools_issues.CreateIssues_get_commentTool(cfg), + tools_issues.CreateIssues_update_commentTool(cfg), + tools_activity.CreateActivity_list_watched_repos_for_authenticated_userTool(cfg), + tools_meta.CreateMeta_get_all_versionsTool(cfg), + tools_issues.CreateIssues_list_milestonesTool(cfg), + tools_issues.CreateIssues_create_milestoneTool(cfg), + tools_copilot.CreateCopilot_cancel_copilot_seat_assignment_for_usersTool(cfg), + tools_copilot.CreateCopilot_add_copilot_seats_for_usersTool(cfg), + tools_actions.CreateActions_enable_workflowTool(cfg), + tools_code_security.CreateCode_security_create_configurationTool(cfg), + tools_code_security.CreateCode_security_get_configurations_for_orgTool(cfg), + tools_actions.CreateActions_review_custom_gates_for_runTool(cfg), + tools_projects.CreateProjects_get_permission_for_userTool(cfg), + tools_apps.CreateApps_remove_repo_from_installation_for_authenticated_userTool(cfg), + tools_apps.CreateApps_add_repo_to_installation_for_authenticated_userTool(cfg), + tools_issues.CreateIssues_list_comments_for_repoTool(cfg), + tools_copilot.CreateCopilot_list_copilot_seatsTool(cfg), + tools_repos.CreateRepos_list_deploymentsTool(cfg), + tools_repos.CreateRepos_create_deploymentTool(cfg), + tools_code_scanning.CreateCode_scanning_list_alerts_for_orgTool(cfg), + tools_teams.CreateTeams_delete_discussion_in_orgTool(cfg), + tools_teams.CreateTeams_get_discussion_in_orgTool(cfg), + tools_teams.CreateTeams_update_discussion_in_orgTool(cfg), + tools_hosted_compute.CreateHosted_compute_get_network_settings_for_orgTool(cfg), + tools_repos.CreateRepos_get_punch_card_statsTool(cfg), + tools_codespaces.CreateCodespaces_list_in_organizationTool(cfg), + tools_packages.CreatePackages_delete_package_for_orgTool(cfg), + tools_packages.CreatePackages_get_package_for_organizationTool(cfg), + tools_apps.CreateApps_get_subscription_plan_for_accountTool(cfg), + tools_users.CreateUsers_check_following_for_userTool(cfg), + tools_repos.CreateRepos_list_invitations_for_authenticated_userTool(cfg), + tools_actions.CreateActions_re_run_workflowTool(cfg), + tools_issues.CreateIssues_delete_labelTool(cfg), + tools_issues.CreateIssues_get_labelTool(cfg), + tools_issues.CreateIssues_update_labelTool(cfg), + tools_activity.CreateActivity_list_notifications_for_authenticated_userTool(cfg), + tools_activity.CreateActivity_mark_notifications_as_readTool(cfg), + tools_migrations.CreateMigrations_list_for_authenticated_userTool(cfg), + tools_migrations.CreateMigrations_start_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_list_branches_for_head_commitTool(cfg), + tools_orgs.CreateOrgs_revoke_all_org_roles_userTool(cfg), tools_repos.CreateRepos_create_dispatch_eventTool(cfg), - tools_codespaces.CreateCodespaces_codespace_machines_for_authenticated_userTool(cfg), - tools_migrations.CreateMigrations_list_repos_for_authenticated_userTool(cfg), - tools_users.CreateUsers_delete_ssh_signing_key_for_authenticated_userTool(cfg), - tools_users.CreateUsers_get_ssh_signing_key_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_remove_outside_collaboratorTool(cfg), - tools_orgs.CreateOrgs_convert_member_to_outside_collaboratorTool(cfg), - tools_checks.CreateChecks_list_for_suiteTool(cfg), - tools_issues.CreateIssues_check_user_can_be_assigned_to_issueTool(cfg), - tools_code_scanning.CreateCode_scanning_delete_analysisTool(cfg), - tools_code_scanning.CreateCode_scanning_get_analysisTool(cfg), - tools_users.CreateUsers_delete_attestations_by_idTool(cfg), - tools_repos.CreateRepos_get_readme_in_directoryTool(cfg), + tools_security_advisories.CreateSecurity_advisories_create_repository_advisoryTool(cfg), + tools_security_advisories.CreateSecurity_advisories_list_repository_advisoriesTool(cfg), + tools_repos.CreateRepos_create_commit_statusTool(cfg), + tools_repos.CreateRepos_get_repo_ruleset_historyTool(cfg), + tools_teams.CreateTeams_list_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_get_codespaces_for_user_in_orgTool(cfg), + tools_dependabot.CreateDependabot_get_repo_public_keyTool(cfg), + tools_actions.CreateActions_get_repo_public_keyTool(cfg), + tools_orgs.CreateOrgs_list_pat_grant_repositoriesTool(cfg), + tools_orgs.CreateOrgs_update_pat_accessTool(cfg), + tools_billing.CreateBilling_get_github_billing_usage_report_orgTool(cfg), + tools_orgs.CreateOrgs_get_org_roleTool(cfg), + tools_orgs.CreateOrgs_list_webhook_deliveriesTool(cfg), + tools_repos.CreateRepos_get_release_by_tagTool(cfg), + tools_teams.CreateTeams_remove_project_in_orgTool(cfg), + tools_teams.CreateTeams_check_permissions_for_project_in_orgTool(cfg), + tools_teams.CreateTeams_add_or_update_project_permissions_in_orgTool(cfg), + tools_actions.CreateActions_get_hosted_runners_machine_specs_for_orgTool(cfg), + tools_codespaces.CreateCodespaces_delete_repo_secretTool(cfg), + tools_codespaces.CreateCodespaces_get_repo_secretTool(cfg), + tools_codespaces.CreateCodespaces_create_or_update_repo_secretTool(cfg), + tools_repos.CreateRepos_list_contributorsTool(cfg), + tools_secret_scanning.CreateSecret_scanning_create_push_protection_bypassTool(cfg), + tools_teams.CreateTeams_get_discussion_legacyTool(cfg), + tools_teams.CreateTeams_update_discussion_legacyTool(cfg), + tools_teams.CreateTeams_delete_discussion_legacyTool(cfg), + tools_pulls.CreatePulls_getTool(cfg), + tools_pulls.CreatePulls_updateTool(cfg), + tools_actions.CreateActions_list_environment_secretsTool(cfg), tools_orgs.CreateOrgs_delete_webhookTool(cfg), tools_orgs.CreateOrgs_get_webhookTool(cfg), tools_orgs.CreateOrgs_update_webhookTool(cfg), - tools_reactions.CreateReactions_create_for_commit_commentTool(cfg), - tools_reactions.CreateReactions_list_for_commit_commentTool(cfg), - tools_apps.CreateApps_list_installations_for_authenticated_userTool(cfg), + tools_users.CreateUsers_get_context_for_userTool(cfg), + tools_repos.CreateRepos_list_webhooksTool(cfg), + tools_repos.CreateRepos_create_webhookTool(cfg), + tools_orgs.CreateOrgs_list_pat_grant_requestsTool(cfg), + tools_orgs.CreateOrgs_review_pat_grant_requests_in_bulkTool(cfg), + tools_emojis.CreateEmojis_getTool(cfg), + tools_actions.CreateActions_delete_self_hosted_runner_from_repoTool(cfg), + tools_actions.CreateActions_get_self_hosted_runner_for_repoTool(cfg), + tools_projects.CreateProjects_deleteTool(cfg), + tools_projects.CreateProjects_getTool(cfg), + tools_projects.CreateProjects_updateTool(cfg), + tools_code_security.CreateCode_security_delete_configuration_for_enterpriseTool(cfg), + tools_code_security.CreateCode_security_get_single_configuration_for_enterpriseTool(cfg), + tools_code_security.CreateCode_security_update_enterprise_configurationTool(cfg), + tools_users.CreateUsers_list_blocked_by_authenticated_userTool(cfg), + tools_copilot.CreateCopilot_copilot_metrics_for_teamTool(cfg), + tools_pulls.CreatePulls_listTool(cfg), + tools_pulls.CreatePulls_createTool(cfg), + tools_packages.CreatePackages_get_all_package_versions_for_package_owned_by_userTool(cfg), + tools_packages.CreatePackages_restore_package_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_list_activitiesTool(cfg), + tools_codespaces.CreateCodespaces_list_secrets_for_authenticated_userTool(cfg), + tools_actions.CreateActions_delete_self_hosted_runner_group_from_orgTool(cfg), + tools_actions.CreateActions_get_self_hosted_runner_group_for_orgTool(cfg), + tools_actions.CreateActions_update_self_hosted_runner_group_for_orgTool(cfg), + tools_codespaces.CreateCodespaces_delete_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_get_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_update_for_authenticated_userTool(cfg), + tools_projects.CreateProjects_move_columnTool(cfg), + tools_codespaces.CreateCodespaces_list_repo_secretsTool(cfg), + tools_actions.CreateActions_list_self_hosted_runner_groups_for_orgTool(cfg), + tools_actions.CreateActions_create_self_hosted_runner_group_for_orgTool(cfg), + tools_code_scanning.CreateCode_scanning_get_alertTool(cfg), + tools_code_scanning.CreateCode_scanning_update_alertTool(cfg), + tools_code_scanning.CreateCode_scanning_list_codeql_databasesTool(cfg), + tools_actions.CreateActions_create_remove_token_for_repoTool(cfg), + tools_activity.CreateActivity_list_repo_notifications_for_authenticated_userTool(cfg), + tools_activity.CreateActivity_mark_repo_notifications_as_readTool(cfg), + tools_projects.CreateProjects_list_for_userTool(cfg), + tools_pulls.CreatePulls_delete_pending_reviewTool(cfg), + tools_pulls.CreatePulls_get_reviewTool(cfg), + tools_pulls.CreatePulls_update_reviewTool(cfg), + tools_git.CreateGit_create_treeTool(cfg), + tools_actions.CreateActions_list_selected_repositories_enabled_github_actions_organizationTool(cfg), + tools_actions.CreateActions_set_selected_repositories_enabled_github_actions_organizationTool(cfg), + tools_orgs.CreateApi_insights_get_time_stats_by_userTool(cfg), + tools_teams.CreateTeams_list_child_legacyTool(cfg), + tools_actions.CreateActions_list_workflow_runsTool(cfg), + tools_repos.CreateRepos_get_commit_activity_statsTool(cfg), + tools_apps.CreateApps_list_accounts_for_planTool(cfg), + tools_codespaces.CreateCodespaces_repo_machines_for_authenticated_userTool(cfg), + tools_reactions.CreateReactions_delete_for_pull_request_commentTool(cfg), + tools_migrations.CreateMigrations_list_for_orgTool(cfg), + tools_migrations.CreateMigrations_start_for_orgTool(cfg), + tools_repos.CreateRepos_list_teamsTool(cfg), + tools_repos.CreateRepos_download_zipball_archiveTool(cfg), + tools_codespaces.CreateCodespaces_get_org_public_keyTool(cfg), + tools_repos.CreateRepos_get_repo_ruleset_versionTool(cfg), tools_checks.CreateChecks_createTool(cfg), - tools_orgs.CreateOrgs_redeliver_webhook_deliveryTool(cfg), - tools_actions.CreateActions_create_remove_token_for_orgTool(cfg), - tools_code_scanning.CreateCode_scanning_get_alertTool(cfg), - tools_code_scanning.CreateCode_scanning_update_alertTool(cfg), - tools_code_security.CreateCode_security_update_configurationTool(cfg), - tools_code_security.CreateCode_security_delete_configurationTool(cfg), - tools_code_security.CreateCode_security_get_configurationTool(cfg), - tools_actions.CreateActions_re_run_job_for_workflow_runTool(cfg), - tools_actions.CreateActions_get_repo_public_keyTool(cfg), - tools_codespaces.CreateCodespaces_stop_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_delete_issue_typeTool(cfg), - tools_orgs.CreateOrgs_update_issue_typeTool(cfg), - tools_repos.CreateRepos_list_activitiesTool(cfg), - tools_pulls.CreatePulls_list_commitsTool(cfg), - tools_actions.CreateActions_get_org_public_keyTool(cfg), - tools_users.CreateUsers_set_primary_email_visibility_for_authenticated_userTool(cfg), - tools_pulls.CreatePulls_delete_review_commentTool(cfg), - tools_pulls.CreatePulls_get_review_commentTool(cfg), - tools_pulls.CreatePulls_update_review_commentTool(cfg), + tools_code_scanning.CreateCode_scanning_list_alert_instancesTool(cfg), + tools_git.CreateGit_create_tagTool(cfg), + tools_activity.CreateActivity_list_events_for_authenticated_userTool(cfg), + tools_actions.CreateActions_get_actions_cache_usage_for_orgTool(cfg), + tools_checks.CreateChecks_set_suites_preferencesTool(cfg), + tools_actions.CreateActions_generate_runner_jitconfig_for_orgTool(cfg), tools_users.CreateUsers_unblockTool(cfg), tools_users.CreateUsers_check_blockedTool(cfg), tools_users.CreateUsers_blockTool(cfg), - tools_apps.CreateApps_get_org_installationTool(cfg), - tools_repos.CreateRepos_get_branch_rulesTool(cfg), - tools_actions.CreateActions_download_job_logs_for_workflow_runTool(cfg), - tools_repos.CreateRepos_delete_org_rulesetTool(cfg), - tools_repos.CreateRepos_get_org_rulesetTool(cfg), - tools_repos.CreateRepos_update_org_rulesetTool(cfg), - tools_activity.CreateActivity_list_org_events_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_get_combined_status_for_refTool(cfg), - tools_repos.CreateRepos_list_releasesTool(cfg), - tools_repos.CreateRepos_create_releaseTool(cfg), - tools_reactions.CreateReactions_delete_for_team_discussionTool(cfg), - tools_dependabot.CreateDependabot_repository_access_for_orgTool(cfg), - tools_dependabot.CreateDependabot_update_repository_access_for_orgTool(cfg), - tools_issues.CreateIssues_list_milestonesTool(cfg), - tools_issues.CreateIssues_create_milestoneTool(cfg), - tools_apps.CreateApps_list_repos_accessible_to_installationTool(cfg), - tools_actions.CreateActions_set_github_actions_default_workflow_permissions_organizationTool(cfg), - tools_actions.CreateActions_get_github_actions_default_workflow_permissions_organizationTool(cfg), - tools_repos.CreateRepos_list_collaboratorsTool(cfg), - tools_migrations.CreateMigrations_list_repos_for_orgTool(cfg), - tools_repos.CreateRepos_delete_deployment_branch_policyTool(cfg), - tools_repos.CreateRepos_get_deployment_branch_policyTool(cfg), - tools_repos.CreateRepos_update_deployment_branch_policyTool(cfg), - tools_issues.CreateIssues_list_labels_for_milestoneTool(cfg), - tools_actions.CreateActions_delete_self_hosted_runner_from_orgTool(cfg), - tools_actions.CreateActions_get_self_hosted_runner_for_orgTool(cfg), - tools_checks.CreateChecks_set_suites_preferencesTool(cfg), - tools_orgs.CreateApi_insights_get_route_stats_by_actorTool(cfg), + tools_repos.CreateRepos_get_org_rule_suiteTool(cfg), + tools_actions.CreateActions_get_workflow_usageTool(cfg), + tools_repos.CreateRepos_list_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_create_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_create_issue_typeTool(cfg), + tools_orgs.CreateOrgs_list_issue_typesTool(cfg), + tools_reactions.CreateReactions_create_for_pull_request_review_commentTool(cfg), + tools_reactions.CreateReactions_list_for_pull_request_review_commentTool(cfg), + tools_codespaces.CreateCodespaces_get_export_details_for_authenticated_userTool(cfg), + tools_activity.CreateActivity_unstar_repo_for_authenticated_userTool(cfg), + tools_activity.CreateActivity_check_repo_is_starred_by_authenticated_userTool(cfg), + tools_activity.CreateActivity_star_repo_for_authenticated_userTool(cfg), + tools_secret_scanning.CreateSecret_scanning_list_locations_for_alertTool(cfg), + tools_gists.CreateGists_list_publicTool(cfg), + tools_actions.CreateActions_generate_runner_jitconfig_for_repoTool(cfg), + tools_repos.CreateRepos_list_pull_requests_associated_with_commitTool(cfg), + tools_repos.CreateRepos_get_org_rulesetsTool(cfg), + tools_repos.CreateRepos_create_org_rulesetTool(cfg), + tools_code_security.CreateCode_security_get_configuration_for_repositoryTool(cfg), + tools_code_scanning.CreateCode_scanning_get_autofixTool(cfg), + tools_code_scanning.CreateCode_scanning_create_autofixTool(cfg), + tools_repos.CreateRepos_list_invitationsTool(cfg), tools_apps.CreateApps_create_installation_access_tokenTool(cfg), - tools_actions.CreateActions_delete_self_hosted_runner_from_repoTool(cfg), - tools_actions.CreateActions_get_self_hosted_runner_for_repoTool(cfg), - tools_search.CreateSearch_usersTool(cfg), - tools_actions.CreateActions_delete_workflow_runTool(cfg), - tools_actions.CreateActions_get_workflow_runTool(cfg), - tools_packages.CreatePackages_get_package_for_organizationTool(cfg), - tools_packages.CreatePackages_delete_package_for_orgTool(cfg), + tools_teams.CreateTeams_delete_legacyTool(cfg), + tools_teams.CreateTeams_get_legacyTool(cfg), + tools_teams.CreateTeams_update_legacyTool(cfg), + tools_git.CreateGit_get_blobTool(cfg), + tools_repos.CreateRepos_create_pages_deploymentTool(cfg), + tools_classroom.CreateClassroom_list_classroomsTool(cfg), + tools_codespaces.CreateCodespaces_stop_in_organizationTool(cfg), + tools_repos.CreateRepos_compare_commitsTool(cfg), tools_billing.CreateBilling_get_github_billing_usage_report_userTool(cfg), - tools_repos.CreateRepos_delete_admin_branch_protectionTool(cfg), - tools_repos.CreateRepos_get_admin_branch_protectionTool(cfg), - tools_repos.CreateRepos_set_admin_branch_protectionTool(cfg), - tools_actions.CreateActions_list_workflow_runsTool(cfg), - tools_activity.CreateActivity_delete_thread_subscriptionTool(cfg), - tools_activity.CreateActivity_get_thread_subscription_for_authenticated_userTool(cfg), - tools_activity.CreateActivity_set_thread_subscriptionTool(cfg), - tools_security_advisories.CreateSecurity_advisories_get_repository_advisoryTool(cfg), - tools_security_advisories.CreateSecurity_advisories_update_repository_advisoryTool(cfg), - tools_repos.CreateRepos_download_tarball_archiveTool(cfg), - tools_orgs.CreateApi_insights_get_user_statsTool(cfg), - tools_actions.CreateActions_get_workflow_usageTool(cfg), - tools_users.CreateUsers_delete_public_ssh_key_for_authenticated_userTool(cfg), - tools_users.CreateUsers_get_public_ssh_key_for_authenticated_userTool(cfg), - tools_migrations.CreateMigrations_get_status_for_orgTool(cfg), - tools_activity.CreateActivity_list_public_events_for_repo_networkTool(cfg), - tools_git.CreateGit_create_commitTool(cfg), - tools_dependabot.CreateDependabot_list_alerts_for_orgTool(cfg), - tools_projects.CreateProjects_delete_cardTool(cfg), - tools_projects.CreateProjects_get_cardTool(cfg), - tools_projects.CreateProjects_update_cardTool(cfg), - tools_activity.CreateActivity_list_notifications_for_authenticated_userTool(cfg), - tools_activity.CreateActivity_mark_notifications_as_readTool(cfg), - tools_pulls.CreatePulls_list_filesTool(cfg), - tools_copilot.CreateCopilot_cancel_copilot_seat_assignment_for_usersTool(cfg), - tools_copilot.CreateCopilot_add_copilot_seats_for_usersTool(cfg), - tools_activity.CreateActivity_list_public_org_eventsTool(cfg), - tools_security_advisories.CreateSecurity_advisories_create_forkTool(cfg), - tools_repos.CreateRepos_get_readmeTool(cfg), - tools_search.CreateSearch_labelsTool(cfg), - tools_licenses.CreateLicenses_getTool(cfg), - tools_code_security.CreateCode_security_get_default_configurations_for_enterpriseTool(cfg), - tools_orgs.CreateOrgs_list_attestations_bulkTool(cfg), + tools_repos.CreateRepos_cancel_pages_deploymentTool(cfg), + tools_billing.CreateBilling_get_github_packages_billing_orgTool(cfg), + tools_apps.CreateApps_get_authenticatedTool(cfg), + tools_codespaces.CreateCodespaces_list_devcontainers_in_repository_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_list_for_userTool(cfg), + tools_code_security.CreateCode_security_set_configuration_as_default_for_enterpriseTool(cfg), + tools_private_registries.CreatePrivate_registries_list_org_private_registriesTool(cfg), + tools_private_registries.CreatePrivate_registries_create_org_private_registryTool(cfg), + tools_packages.CreatePackages_delete_package_version_for_orgTool(cfg), + tools_packages.CreatePackages_get_package_version_for_organizationTool(cfg), + tools_packages.CreatePackages_delete_package_version_for_userTool(cfg), + tools_packages.CreatePackages_get_package_version_for_userTool(cfg), tools_dependabot.CreateDependabot_list_repo_secretsTool(cfg), + tools_orgs.CreateOrgs_remove_custom_propertyTool(cfg), + tools_orgs.CreateOrgs_get_custom_propertyTool(cfg), + tools_orgs.CreateOrgs_create_or_update_custom_propertyTool(cfg), + tools_migrations.CreateMigrations_delete_archive_for_authenticated_userTool(cfg), + tools_migrations.CreateMigrations_get_archive_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_get_commit_commentTool(cfg), + tools_repos.CreateRepos_update_commit_commentTool(cfg), + tools_repos.CreateRepos_delete_commit_commentTool(cfg), + tools_codespaces.CreateCodespaces_get_org_secretTool(cfg), + tools_codespaces.CreateCodespaces_create_or_update_org_secretTool(cfg), + tools_codespaces.CreateCodespaces_delete_org_secretTool(cfg), + tools_reactions.CreateReactions_list_for_team_discussion_comment_legacyTool(cfg), + tools_reactions.CreateReactions_create_for_team_discussion_comment_legacyTool(cfg), + tools_issues.CreateIssues_list_for_orgTool(cfg), + tools_repos.CreateRepos_get_all_topicsTool(cfg), + tools_repos.CreateRepos_replace_all_topicsTool(cfg), + tools_apps.CreateApps_scope_tokenTool(cfg), + tools_orgs.CreateOrgs_list_webhooksTool(cfg), + tools_orgs.CreateOrgs_create_webhookTool(cfg), + tools_codespaces.CreateCodespaces_codespace_machines_for_authenticated_userTool(cfg), + tools_apps.CreateApps_list_plansTool(cfg), + tools_users.CreateUsers_delete_attestations_by_idTool(cfg), + tools_orgs.CreateOrgs_revoke_all_org_roles_teamTool(cfg), + tools_apps.CreateApps_get_user_installationTool(cfg), + tools_search.CreateSearch_topicsTool(cfg), + tools_repos.CreateRepos_list_for_orgTool(cfg), + tools_repos.CreateRepos_create_in_orgTool(cfg), + tools_oidc.CreateOidc_get_oidc_custom_sub_template_for_orgTool(cfg), + tools_oidc.CreateOidc_update_oidc_custom_sub_template_for_orgTool(cfg), + tools_gists.CreateGists_list_starredTool(cfg), + tools_pulls.CreatePulls_list_review_comments_for_repoTool(cfg), + tools_checks.CreateChecks_list_suites_for_refTool(cfg), + tools_orgs.CreateOrgs_list_public_membersTool(cfg), + tools_repos.CreateRepos_get_repo_rule_suiteTool(cfg), + tools_billing.CreateBilling_get_github_actions_billing_userTool(cfg), + tools_users.CreateUsers_delete_email_for_authenticated_userTool(cfg), + tools_users.CreateUsers_list_emails_for_authenticated_userTool(cfg), + tools_users.CreateUsers_add_email_for_authenticated_userTool(cfg), + tools_packages.CreatePackages_delete_package_for_authenticated_userTool(cfg), + tools_packages.CreatePackages_get_package_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_list_org_rolesTool(cfg), + tools_repos.CreateRepos_create_tag_protectionTool(cfg), + tools_repos.CreateRepos_list_tag_protectionTool(cfg), tools_actions.CreateActions_delete_org_variableTool(cfg), tools_actions.CreateActions_get_org_variableTool(cfg), tools_actions.CreateActions_update_org_variableTool(cfg), - tools_actions.CreateActions_get_job_for_workflow_runTool(cfg), - tools_secret_scanning.CreateSecret_scanning_list_alerts_for_repoTool(cfg), - tools_orgs.CreateOrgs_list_failed_invitationsTool(cfg), + tools_actions.CreateActions_delete_actions_cache_by_keyTool(cfg), + tools_actions.CreateActions_get_actions_cache_listTool(cfg), + tools_orgs.CreateOrgs_review_pat_grant_requestTool(cfg), + tools_gitignore.CreateGitignore_get_templateTool(cfg), + tools_orgs.CreateOrgs_list_attestationsTool(cfg), + tools_repos.CreateRepos_list_release_assetsTool(cfg), + tools_repos.CreateRepos_list_attestationsTool(cfg), + tools_code_security.CreateCode_security_attach_configurationTool(cfg), + tools_repos.CreateRepos_list_collaboratorsTool(cfg), + tools_secret_scanning.CreateSecret_scanning_get_scan_historyTool(cfg), + tools_teams.CreateTeams_listTool(cfg), + tools_teams.CreateTeams_createTool(cfg), + tools_activity.CreateActivity_list_received_public_events_for_userTool(cfg), + tools_teams.CreateTeams_delete_discussion_comment_in_orgTool(cfg), + tools_teams.CreateTeams_get_discussion_comment_in_orgTool(cfg), + tools_teams.CreateTeams_update_discussion_comment_in_orgTool(cfg), + tools_projects.CreateProjects_list_for_orgTool(cfg), + tools_projects.CreateProjects_create_for_orgTool(cfg), + tools_classroom.CreateClassroom_get_assignment_gradesTool(cfg), + tools_actions.CreateActions_get_pending_deployments_for_runTool(cfg), + tools_actions.CreateActions_review_pending_deployments_for_runTool(cfg), + tools_teams.CreateTeams_list_members_legacyTool(cfg), + tools_actions.CreateActions_delete_workflow_runTool(cfg), + tools_actions.CreateActions_get_workflow_runTool(cfg), + tools_apps.CreateApps_get_webhook_config_for_appTool(cfg), + tools_apps.CreateApps_update_webhook_config_for_appTool(cfg), + tools_migrations.CreateMigrations_get_large_filesTool(cfg), + tools_issues.CreateIssues_reprioritize_sub_issueTool(cfg), + tools_teams.CreateTeams_list_members_in_orgTool(cfg), + tools_projects.CreateProjects_list_for_repoTool(cfg), + tools_projects.CreateProjects_create_for_repoTool(cfg), + tools_apps.CreateApps_revoke_installation_access_tokenTool(cfg), + tools_users.CreateUsers_get_by_idTool(cfg), tools_teams.CreateTeams_remove_repo_legacyTool(cfg), tools_teams.CreateTeams_check_permissions_for_repo_legacyTool(cfg), tools_teams.CreateTeams_add_or_update_repo_permissions_legacyTool(cfg), - tools_actions.CreateActions_get_workflow_run_usageTool(cfg), - tools_repos.CreateRepos_get_pages_buildTool(cfg), - tools_dependabot.CreateDependabot_list_alerts_for_enterpriseTool(cfg), - tools_repos.CreateRepos_delete_commit_signature_protectionTool(cfg), - tools_repos.CreateRepos_get_commit_signature_protectionTool(cfg), - tools_repos.CreateRepos_create_commit_signature_protectionTool(cfg), - tools_classroom.CreateClassroom_list_classroomsTool(cfg), - tools_repos.CreateRepos_get_participation_statsTool(cfg), - tools_actions.CreateActions_remove_selected_repo_from_org_secretTool(cfg), - tools_actions.CreateActions_add_selected_repo_to_org_secretTool(cfg), - tools_actions.CreateActions_delete_artifactTool(cfg), - tools_actions.CreateActions_get_artifactTool(cfg), - tools_billing.CreateBilling_get_shared_storage_billing_userTool(cfg), - tools_codespaces.CreateCodespaces_list_in_repository_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_create_with_repo_for_authenticated_userTool(cfg), - tools_activity.CreateActivity_list_events_for_authenticated_userTool(cfg), + tools_gists.CreateGists_listTool(cfg), + tools_gists.CreateGists_createTool(cfg), + tools_packages.CreatePackages_list_packages_for_organizationTool(cfg), + tools_migrations.CreateMigrations_unlock_repo_for_authenticated_userTool(cfg), + tools_gitignore.CreateGitignore_get_all_templatesTool(cfg), + tools_orgs.CreateOrgs_check_membership_for_userTool(cfg), + tools_orgs.CreateOrgs_remove_memberTool(cfg), + tools_repos.CreateRepos_ping_webhookTool(cfg), + tools_actions.CreateActions_get_workflow_access_to_repositoryTool(cfg), + tools_actions.CreateActions_set_workflow_access_to_repositoryTool(cfg), + tools_codespaces.CreateCodespaces_delete_from_organizationTool(cfg), + tools_repos.CreateRepos_remove_app_access_restrictionsTool(cfg), + tools_repos.CreateRepos_get_apps_with_access_to_protected_branchTool(cfg), + tools_repos.CreateRepos_add_app_access_restrictionsTool(cfg), + tools_repos.CreateRepos_set_app_access_restrictionsTool(cfg), + tools_apps.CreateApps_get_webhook_deliveryTool(cfg), + tools_reactions.CreateReactions_list_for_team_discussion_in_orgTool(cfg), + tools_reactions.CreateReactions_create_for_team_discussion_in_orgTool(cfg), + tools_code_security.CreateCode_security_delete_configurationTool(cfg), + tools_code_security.CreateCode_security_get_configurationTool(cfg), + tools_code_security.CreateCode_security_update_configurationTool(cfg), + tools_teams.CreateTeams_list_pending_invitations_in_orgTool(cfg), + tools_users.CreateUsers_list_ssh_signing_keys_for_userTool(cfg), + tools_repos.CreateRepos_list_deploy_keysTool(cfg), + tools_repos.CreateRepos_create_deploy_keyTool(cfg), + tools_checks.CreateChecks_list_for_refTool(cfg), + tools_pulls.CreatePulls_list_comments_for_reviewTool(cfg), + tools_repos.CreateRepos_get_contributors_statsTool(cfg), + tools_repos.CreateRepos_delete_an_environmentTool(cfg), + tools_repos.CreateRepos_get_environmentTool(cfg), + tools_repos.CreateRepos_create_or_update_environmentTool(cfg), + tools_repos.CreateRepos_test_push_webhookTool(cfg), + tools_orgs.CreateOrgs_list_memberships_for_authenticated_userTool(cfg), + tools_repos.CreateRepos_get_webhook_deliveryTool(cfg), + tools_actions.CreateActions_list_hosted_runners_for_orgTool(cfg), + tools_actions.CreateActions_create_hosted_runner_for_orgTool(cfg), + tools_orgs.CreateApi_insights_get_time_statsTool(cfg), + tools_teams.CreateTeams_delete_discussion_comment_legacyTool(cfg), + tools_teams.CreateTeams_get_discussion_comment_legacyTool(cfg), + tools_teams.CreateTeams_update_discussion_comment_legacyTool(cfg), + tools_orgs.CreateApi_insights_get_summary_stats_by_userTool(cfg), + tools_security_advisories.CreateSecurity_advisories_get_global_advisoryTool(cfg), + tools_code_security.CreateCode_security_get_configurations_for_enterpriseTool(cfg), + tools_code_security.CreateCode_security_create_configuration_for_enterpriseTool(cfg), + tools_packages.CreatePackages_delete_package_for_userTool(cfg), + tools_packages.CreatePackages_get_package_for_userTool(cfg), + tools_actions.CreateActions_delete_environment_variableTool(cfg), + tools_actions.CreateActions_get_environment_variableTool(cfg), + tools_actions.CreateActions_update_environment_variableTool(cfg), + tools_private_registries.CreatePrivate_registries_delete_org_private_registryTool(cfg), + tools_private_registries.CreatePrivate_registries_get_org_private_registryTool(cfg), + tools_private_registries.CreatePrivate_registries_update_org_private_registryTool(cfg), + tools_actions.CreateActions_download_job_logs_for_workflow_runTool(cfg), + tools_repos.CreateRepos_delete_invitationTool(cfg), + tools_repos.CreateRepos_update_invitationTool(cfg), + tools_actions.CreateActions_force_cancel_workflow_runTool(cfg), + tools_git.CreateGit_create_blobTool(cfg), + tools_secret_scanning.CreateSecret_scanning_get_alertTool(cfg), + tools_secret_scanning.CreateSecret_scanning_update_alertTool(cfg), + tools_codespaces.CreateCodespaces_get_public_key_for_authenticated_userTool(cfg), tools_teams.CreateTeams_list_discussions_legacyTool(cfg), tools_teams.CreateTeams_create_discussion_legacyTool(cfg), - tools_actions.CreateActions_list_self_hosted_runners_for_orgTool(cfg), - tools_actions.CreateActions_update_self_hosted_runner_group_for_orgTool(cfg), - tools_actions.CreateActions_delete_self_hosted_runner_group_from_orgTool(cfg), - tools_actions.CreateActions_get_self_hosted_runner_group_for_orgTool(cfg), - tools_actions.CreateActions_create_hosted_runner_for_orgTool(cfg), - tools_actions.CreateActions_list_hosted_runners_for_orgTool(cfg), - tools_repos.CreateRepos_delete_deploy_keyTool(cfg), - tools_repos.CreateRepos_get_deploy_keyTool(cfg), - tools_repos.CreateRepos_list_release_assetsTool(cfg), - tools_code_security.CreateCode_security_attach_configurationTool(cfg), - tools_issues.CreateIssues_list_events_for_repoTool(cfg), - tools_users.CreateUsers_get_authenticatedTool(cfg), - tools_users.CreateUsers_update_authenticatedTool(cfg), - tools_apps.CreateApps_list_accounts_for_planTool(cfg), - tools_codespaces.CreateCodespaces_start_for_authenticated_userTool(cfg), - tools_checks.CreateChecks_get_suiteTool(cfg), - tools_orgs.CreateOrgs_unblock_userTool(cfg), - tools_orgs.CreateOrgs_check_blocked_userTool(cfg), - tools_orgs.CreateOrgs_block_userTool(cfg), - tools_repos.CreateRepos_list_invitations_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_merge_upstreamTool(cfg), - tools_teams.CreateTeams_remove_member_legacyTool(cfg), - tools_teams.CreateTeams_get_member_legacyTool(cfg), - tools_teams.CreateTeams_add_member_legacyTool(cfg), - tools_issues.CreateIssues_list_for_repoTool(cfg), - tools_issues.CreateIssues_createTool(cfg), - tools_repos.CreateRepos_test_push_webhookTool(cfg), - tools_apps.CreateApps_delete_installationTool(cfg), - tools_apps.CreateApps_get_installationTool(cfg), - tools_issues.CreateIssues_list_events_for_timelineTool(cfg), - tools_search.CreateSearch_codeTool(cfg), - tools_repos.CreateRepos_get_repo_ruleset_versionTool(cfg), - tools_repos.CreateRepos_get_commit_activity_statsTool(cfg), - tools_migrations.CreateMigrations_get_commit_authorsTool(cfg), - tools_packages.CreatePackages_list_packages_for_authenticated_userTool(cfg), - tools_pulls.CreatePulls_create_reply_for_review_commentTool(cfg), - tools_projects.CreateProjects_move_cardTool(cfg), - tools_teams.CreateTeams_list_pending_invitations_in_orgTool(cfg), - tools_classroom.CreateClassroom_list_accepted_assignments_for_an_assignmentTool(cfg), - tools_migrations.CreateMigrations_map_commit_authorTool(cfg), - tools_repos.CreateRepos_create_deploymentTool(cfg), - tools_repos.CreateRepos_list_deploymentsTool(cfg), - tools_repos.CreateRepos_cancel_pages_deploymentTool(cfg), - tools_codespaces.CreateCodespaces_set_codespaces_accessTool(cfg), - tools_reactions.CreateReactions_list_for_team_discussion_comment_legacyTool(cfg), - tools_reactions.CreateReactions_create_for_team_discussion_comment_legacyTool(cfg), - tools_codespaces.CreateCodespaces_export_for_authenticated_userTool(cfg), + tools_packages.CreatePackages_restore_package_version_for_orgTool(cfg), + tools_actions.CreateActions_list_runner_applications_for_repoTool(cfg), + tools_projects.CreateProjects_list_collaboratorsTool(cfg), + tools_actions.CreateActions_get_job_for_workflow_runTool(cfg), + tools_repos.CreateRepos_get_repo_rule_suitesTool(cfg), + tools_issues.CreateIssues_list_labels_for_repoTool(cfg), + tools_issues.CreateIssues_create_labelTool(cfg), tools_orgs.CreateOrgs_deleteTool(cfg), tools_orgs.CreateOrgs_getTool(cfg), tools_orgs.CreateOrgs_updateTool(cfg), - tools_repos.CreateRepos_get_commitTool(cfg), - tools_repos.CreateRepos_get_repo_rule_suiteTool(cfg), - tools_actions.CreateActions_delete_actions_cache_by_keyTool(cfg), - tools_actions.CreateActions_get_actions_cache_listTool(cfg), - tools_repos.CreateRepos_list_for_userTool(cfg), - tools_orgs.CreateOrgs_listTool(cfg), - tools_users.CreateUsers_list_social_accounts_for_authenticated_userTool(cfg), - tools_users.CreateUsers_add_social_account_for_authenticated_userTool(cfg), - tools_users.CreateUsers_delete_social_account_for_authenticated_userTool(cfg), - tools_apps.CreateApps_redeliver_webhook_deliveryTool(cfg), - tools_issues.CreateIssues_check_user_can_be_assignedTool(cfg), - tools_apps.CreateApps_revoke_installation_access_tokenTool(cfg), - tools_repos.CreateRepos_delete_repo_rulesetTool(cfg), - tools_repos.CreateRepos_get_repo_rulesetTool(cfg), - tools_repos.CreateRepos_update_repo_rulesetTool(cfg), + tools_actions.CreateActions_list_artifacts_for_repoTool(cfg), + tools_code_security.CreateCode_security_get_default_configurationsTool(cfg), + tools_issues.CreateIssues_unlockTool(cfg), + tools_issues.CreateIssues_lockTool(cfg), + tools_repos.CreateRepos_get_readme_in_directoryTool(cfg), + tools_actions.CreateActions_list_self_hosted_runners_for_orgTool(cfg), + tools_activity.CreateActivity_mark_thread_as_doneTool(cfg), + tools_activity.CreateActivity_get_threadTool(cfg), + tools_activity.CreateActivity_mark_thread_as_readTool(cfg), + tools_actions.CreateActions_get_github_actions_default_workflow_permissions_repositoryTool(cfg), + tools_actions.CreateActions_set_github_actions_default_workflow_permissions_repositoryTool(cfg), + tools_repos.CreateRepos_create_or_update_file_contentsTool(cfg), + tools_repos.CreateRepos_delete_fileTool(cfg), + tools_repos.CreateRepos_get_contentTool(cfg), + tools_repos.CreateRepos_delete_pages_siteTool(cfg), + tools_repos.CreateRepos_get_pagesTool(cfg), + tools_repos.CreateRepos_create_pages_siteTool(cfg), + tools_repos.CreateRepos_update_information_about_pages_siteTool(cfg), + tools_rate_limit.CreateRate_limit_getTool(cfg), + tools_repos.CreateRepos_mergeTool(cfg), + tools_issues.CreateIssues_list_assigneesTool(cfg), + tools_teams.CreateTeams_list_repos_legacyTool(cfg), + tools_dependabot.CreateDependabot_add_selected_repo_to_org_secretTool(cfg), + tools_dependabot.CreateDependabot_remove_selected_repo_from_org_secretTool(cfg), + tools_orgs.CreateOrgs_list_pending_invitationsTool(cfg), + tools_orgs.CreateOrgs_create_invitationTool(cfg), + tools_licenses.CreateLicenses_getTool(cfg), + tools_actions.CreateActions_list_self_hosted_runners_in_group_for_orgTool(cfg), + tools_actions.CreateActions_set_self_hosted_runners_in_group_for_orgTool(cfg), + tools_repos.CreateRepos_list_webhook_deliveriesTool(cfg), tools_orgs.CreateOrgs_get_webhook_deliveryTool(cfg), - tools_apps.CreateApps_get_repo_installationTool(cfg), - tools_repos.CreateRepos_get_commit_commentTool(cfg), - tools_repos.CreateRepos_update_commit_commentTool(cfg), - tools_repos.CreateRepos_delete_commit_commentTool(cfg), - tools_projects.CreateProjects_remove_collaboratorTool(cfg), - tools_projects.CreateProjects_add_collaboratorTool(cfg), - tools_apps.CreateApps_list_accounts_for_plan_stubbedTool(cfg), - tools_codespaces.CreateCodespaces_list_repo_secretsTool(cfg), - tools_activity.CreateActivity_list_public_events_for_userTool(cfg), - tools_code_security.CreateCode_security_detach_configurationTool(cfg), - tools_projects.CreateProjects_list_collaboratorsTool(cfg), - tools_repos.CreateRepos_get_release_by_tagTool(cfg), - tools_code_scanning.CreateCode_scanning_upload_sarifTool(cfg), - tools_codespaces.CreateCodespaces_repo_machines_for_authenticated_userTool(cfg), - tools_git.CreateGit_create_tagTool(cfg), - tools_teams.CreateTeams_update_in_orgTool(cfg), - tools_teams.CreateTeams_delete_in_orgTool(cfg), - tools_teams.CreateTeams_get_by_nameTool(cfg), - tools_dependency_graph.CreateDependency_graph_export_sbomTool(cfg), - tools_repos.CreateRepos_delete_autolinkTool(cfg), - tools_repos.CreateRepos_get_autolinkTool(cfg), - tools_repos.CreateRepos_get_code_frequency_statsTool(cfg), - tools_users.CreateUsers_get_context_for_userTool(cfg), - tools_repos.CreateRepos_list_branchesTool(cfg), - tools_orgs.CreateOrgs_remove_custom_propertyTool(cfg), - tools_orgs.CreateOrgs_get_custom_propertyTool(cfg), - tools_orgs.CreateOrgs_create_or_update_custom_propertyTool(cfg), - tools_code_security.CreateCode_security_get_repositories_for_configurationTool(cfg), - tools_interactions.CreateInteractions_remove_restrictions_for_authenticated_userTool(cfg), - tools_interactions.CreateInteractions_get_restrictions_for_authenticated_userTool(cfg), - tools_interactions.CreateInteractions_set_restrictions_for_authenticated_userTool(cfg), - tools_actions.CreateActions_download_artifactTool(cfg), + tools_repos.CreateRepos_delete_releaseTool(cfg), + tools_repos.CreateRepos_get_releaseTool(cfg), + tools_repos.CreateRepos_update_releaseTool(cfg), + tools_users.CreateUsers_list_public_keys_for_userTool(cfg), + tools_dependency_graph.CreateDependency_graph_create_repository_snapshotTool(cfg), + tools_repos.CreateRepos_update_webhook_config_for_repoTool(cfg), + tools_repos.CreateRepos_get_webhook_config_for_repoTool(cfg), + tools_repos.CreateRepos_add_team_access_restrictionsTool(cfg), + tools_repos.CreateRepos_set_team_access_restrictionsTool(cfg), + tools_repos.CreateRepos_remove_team_access_restrictionsTool(cfg), + tools_repos.CreateRepos_get_teams_with_access_to_protected_branchTool(cfg), + tools_actions.CreateActions_delete_self_hosted_runner_from_orgTool(cfg), + tools_actions.CreateActions_get_self_hosted_runner_for_orgTool(cfg), + tools_pulls.CreatePulls_update_branchTool(cfg), + tools_users.CreateUsers_list_gpg_keys_for_userTool(cfg), + tools_repos.CreateRepos_create_attestationTool(cfg), + tools_codespaces.CreateCodespaces_list_in_repository_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_create_with_repo_for_authenticated_userTool(cfg), + tools_copilot.CreateCopilot_cancel_copilot_seat_assignment_for_teamsTool(cfg), + tools_copilot.CreateCopilot_add_copilot_seats_for_teamsTool(cfg), tools_repos.CreateRepos_remove_status_check_protectionTool(cfg), tools_repos.CreateRepos_get_status_checks_protectionTool(cfg), tools_repos.CreateRepos_update_status_check_protectionTool(cfg), - tools_projects.CreateProjects_list_for_repoTool(cfg), - tools_projects.CreateProjects_create_for_repoTool(cfg), - tools_actions.CreateActions_remove_all_custom_labels_from_self_hosted_runner_for_orgTool(cfg), - tools_actions.CreateActions_list_labels_for_self_hosted_runner_for_orgTool(cfg), - tools_actions.CreateActions_add_custom_labels_to_self_hosted_runner_for_orgTool(cfg), - tools_actions.CreateActions_set_custom_labels_for_self_hosted_runner_for_orgTool(cfg), - tools_campaigns.CreateCampaigns_create_campaignTool(cfg), - tools_campaigns.CreateCampaigns_list_org_campaignsTool(cfg), - tools_checks.CreateChecks_list_for_refTool(cfg), - tools_migrations.CreateMigrations_delete_archive_for_authenticated_userTool(cfg), - tools_migrations.CreateMigrations_get_archive_for_authenticated_userTool(cfg), - tools_pulls.CreatePulls_listTool(cfg), - tools_pulls.CreatePulls_createTool(cfg), - tools_code_scanning.CreateCode_scanning_list_codeql_databasesTool(cfg), - tools_dependency_graph.CreateDependency_graph_diff_rangeTool(cfg), - tools_actions.CreateActions_create_remove_token_for_repoTool(cfg), - tools_repos.CreateRepos_list_languagesTool(cfg), - tools_users.CreateUsers_delete_attestations_bulkTool(cfg), - tools_codespaces.CreateCodespaces_list_secrets_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_get_public_key_for_authenticated_userTool(cfg), - tools_migrations.CreateMigrations_get_import_statusTool(cfg), - tools_migrations.CreateMigrations_update_importTool(cfg), - tools_migrations.CreateMigrations_start_importTool(cfg), - tools_migrations.CreateMigrations_cancel_importTool(cfg), - tools_actions.CreateActions_remove_all_custom_labels_from_self_hosted_runner_for_repoTool(cfg), - tools_actions.CreateActions_list_labels_for_self_hosted_runner_for_repoTool(cfg), - tools_actions.CreateActions_add_custom_labels_to_self_hosted_runner_for_repoTool(cfg), - tools_actions.CreateActions_set_custom_labels_for_self_hosted_runner_for_repoTool(cfg), - tools_orgs.CreateOrgs_create_webhookTool(cfg), - tools_orgs.CreateOrgs_list_webhooksTool(cfg), - tools_actions.CreateActions_delete_environment_variableTool(cfg), - tools_actions.CreateActions_get_environment_variableTool(cfg), - tools_actions.CreateActions_update_environment_variableTool(cfg), - tools_packages.CreatePackages_delete_package_for_authenticated_userTool(cfg), - tools_packages.CreatePackages_get_package_for_authenticated_userTool(cfg), - tools_repos.CreateRepos_deleteTool(cfg), - tools_repos.CreateRepos_getTool(cfg), - tools_repos.CreateRepos_updateTool(cfg), - tools_pulls.CreatePulls_dismiss_reviewTool(cfg), - tools_issues.CreateIssues_add_sub_issueTool(cfg), - tools_issues.CreateIssues_list_sub_issuesTool(cfg), - tools_orgs.CreateOrgs_revoke_org_role_userTool(cfg), - tools_orgs.CreateOrgs_assign_user_to_org_roleTool(cfg), - tools_packages.CreatePackages_restore_package_for_authenticated_userTool(cfg), + tools_actions.CreateActions_list_workflow_run_artifactsTool(cfg), + tools_code_scanning.CreateCode_scanning_upload_sarifTool(cfg), + tools_actions.CreateActions_set_github_actions_permissions_organizationTool(cfg), + tools_actions.CreateActions_get_github_actions_permissions_organizationTool(cfg), + tools_actions.CreateActions_remove_selected_repo_from_org_variableTool(cfg), + tools_actions.CreateActions_add_selected_repo_to_org_variableTool(cfg), + tools_activity.CreateActivity_get_feedsTool(cfg), + tools_interactions.CreateInteractions_set_restrictions_for_authenticated_userTool(cfg), + tools_interactions.CreateInteractions_remove_restrictions_for_authenticated_userTool(cfg), + tools_interactions.CreateInteractions_get_restrictions_for_authenticated_userTool(cfg), + tools_checks.CreateChecks_create_suiteTool(cfg), + tools_actions.CreateActions_list_selected_repos_for_org_variableTool(cfg), + tools_actions.CreateActions_set_selected_repos_for_org_variableTool(cfg), + tools_git.CreateGit_delete_refTool(cfg), + tools_git.CreateGit_update_refTool(cfg), + tools_security_advisories.CreateSecurity_advisories_update_repository_advisoryTool(cfg), + tools_security_advisories.CreateSecurity_advisories_get_repository_advisoryTool(cfg), + tools_migrations.CreateMigrations_get_commit_authorsTool(cfg), + tools_apps.CreateApps_list_installations_for_authenticated_userTool(cfg), + tools_reactions.CreateReactions_delete_for_issue_commentTool(cfg), + tools_apps.CreateApps_list_subscriptions_for_authenticated_userTool(cfg), + tools_orgs.CreateOrgs_list_pat_grant_request_repositoriesTool(cfg), + tools_users.CreateUsers_list_followed_by_authenticated_userTool(cfg), + tools_apps.CreateApps_list_accounts_for_plan_stubbedTool(cfg), + tools_packages.CreatePackages_get_all_package_versions_for_package_owned_by_orgTool(cfg), tools_repos.CreateRepos_remove_user_access_restrictionsTool(cfg), tools_repos.CreateRepos_get_users_with_access_to_protected_branchTool(cfg), tools_repos.CreateRepos_add_user_access_restrictionsTool(cfg), tools_repos.CreateRepos_set_user_access_restrictionsTool(cfg), - tools_git.CreateGit_list_matching_refsTool(cfg), - tools_orgs.CreateOrgs_list_outside_collaboratorsTool(cfg), - tools_apps.CreateApps_get_subscription_plan_for_account_stubbedTool(cfg), - tools_security_advisories.CreateSecurity_advisories_list_org_repository_advisoriesTool(cfg), - tools_repos.CreateRepos_remove_collaboratorTool(cfg), - tools_repos.CreateRepos_check_collaboratorTool(cfg), - tools_repos.CreateRepos_add_collaboratorTool(cfg), - tools_users.CreateUsers_list_public_emails_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_get_org_roleTool(cfg), - tools_actions.CreateActions_remove_selected_repo_from_org_variableTool(cfg), - tools_actions.CreateActions_add_selected_repo_to_org_variableTool(cfg), - tools_search.CreateSearch_topicsTool(cfg), - tools_repos.CreateRepos_get_webhook_deliveryTool(cfg), - tools_orgs.CreateOrgs_delete_attestations_by_idTool(cfg), - tools_users.CreateUsers_delete_attestations_by_subject_digestTool(cfg), - tools_apps.CreateApps_get_authenticatedTool(cfg), - tools_actions.CreateActions_list_github_hosted_runners_in_group_for_orgTool(cfg), - tools_pulls.CreatePulls_list_comments_for_reviewTool(cfg), - tools_actions.CreateActions_list_selected_repos_for_org_secretTool(cfg), - tools_actions.CreateActions_set_selected_repos_for_org_secretTool(cfg), + tools_repos.CreateRepos_get_top_referrersTool(cfg), + tools_orgs.CreateOrgs_list_org_role_usersTool(cfg), + tools_teams.CreateTeams_add_or_update_membership_for_user_legacyTool(cfg), + tools_teams.CreateTeams_remove_membership_for_user_legacyTool(cfg), + tools_teams.CreateTeams_get_membership_for_user_legacyTool(cfg), + tools_campaigns.CreateCampaigns_delete_campaignTool(cfg), + tools_campaigns.CreateCampaigns_get_campaign_summaryTool(cfg), + tools_campaigns.CreateCampaigns_update_campaignTool(cfg), + tools_licenses.CreateLicenses_get_all_commonly_usedTool(cfg), + tools_orgs.CreateOrgs_unblock_userTool(cfg), + tools_orgs.CreateOrgs_check_blocked_userTool(cfg), + tools_orgs.CreateOrgs_block_userTool(cfg), + tools_repos.CreateRepos_get_clonesTool(cfg), + tools_activity.CreateActivity_list_public_org_eventsTool(cfg), + tools_actions.CreateActions_re_run_workflow_failed_jobsTool(cfg), + tools_orgs.CreateOrgs_list_failed_invitationsTool(cfg), + tools_code_scanning.CreateCode_scanning_list_alerts_for_repoTool(cfg), + tools_actions.CreateActions_remove_custom_label_from_self_hosted_runner_for_repoTool(cfg), + tools_activity.CreateActivity_list_public_eventsTool(cfg), tools_pulls.CreatePulls_list_reviewsTool(cfg), tools_pulls.CreatePulls_create_reviewTool(cfg), - tools_migrations.CreateMigrations_delete_archive_for_orgTool(cfg), - tools_migrations.CreateMigrations_download_archive_for_orgTool(cfg), - tools_teams.CreateTeams_list_child_legacyTool(cfg), - tools_repos.CreateRepos_get_top_referrersTool(cfg), - tools_repos.CreateRepos_create_using_templateTool(cfg), - tools_code_scanning.CreateCode_scanning_get_autofixTool(cfg), - tools_code_scanning.CreateCode_scanning_create_autofixTool(cfg), - tools_orgs.CreateOrgs_list_invitation_teamsTool(cfg), - tools_codespaces.CreateCodespaces_delete_org_secretTool(cfg), - tools_codespaces.CreateCodespaces_get_org_secretTool(cfg), - tools_codespaces.CreateCodespaces_create_or_update_org_secretTool(cfg), - tools_orgs.CreateApi_insights_get_summary_stats_by_userTool(cfg), - tools_projects.CreateProjects_deleteTool(cfg), - tools_projects.CreateProjects_getTool(cfg), - tools_projects.CreateProjects_updateTool(cfg), - tools_actions.CreateActions_remove_custom_label_from_self_hosted_runner_for_orgTool(cfg), - tools_pulls.CreatePulls_submit_reviewTool(cfg), - tools_search.CreateSearch_reposTool(cfg), - tools_actions.CreateActions_list_self_hosted_runners_for_repoTool(cfg), - tools_users.CreateUsers_list_social_accounts_for_userTool(cfg), - tools_teams.CreateTeams_list_repos_in_orgTool(cfg), - tools_repos.CreateRepos_list_deployment_branch_policiesTool(cfg), - tools_repos.CreateRepos_create_deployment_branch_policyTool(cfg), - tools_repos.CreateRepos_list_deployment_statusesTool(cfg), - tools_repos.CreateRepos_create_deployment_statusTool(cfg), - tools_hosted_compute.CreateHosted_compute_get_network_settings_for_orgTool(cfg), - tools_dependency_graph.CreateDependency_graph_create_repository_snapshotTool(cfg), + tools_orgs.CreateApi_insights_get_time_stats_by_actorTool(cfg), + tools_orgs.CreateOrgs_list_outside_collaboratorsTool(cfg), + tools_codes_of_conduct.CreateCodes_of_conduct_get_all_codes_of_conductTool(cfg), + tools_repos.CreateRepos_merge_upstreamTool(cfg), + tools_issues.CreateIssues_list_events_for_timelineTool(cfg), + tools_migrations.CreateMigrations_set_lfs_preferenceTool(cfg), + tools_activity.CreateActivity_list_repos_starred_by_authenticated_userTool(cfg), + tools_migrations.CreateMigrations_cancel_importTool(cfg), + tools_migrations.CreateMigrations_get_import_statusTool(cfg), + tools_migrations.CreateMigrations_update_importTool(cfg), + tools_migrations.CreateMigrations_start_importTool(cfg), + tools_orgs.CreateOrgs_list_blocked_usersTool(cfg), + tools_packages.CreatePackages_restore_package_for_orgTool(cfg), + tools_campaigns.CreateCampaigns_list_org_campaignsTool(cfg), + tools_campaigns.CreateCampaigns_create_campaignTool(cfg), + tools_dependabot.CreateDependabot_list_alerts_for_orgTool(cfg), + tools_pulls.CreatePulls_dismiss_reviewTool(cfg), + tools_orgs.CreateOrgs_list_org_role_teamsTool(cfg), + tools_packages.CreatePackages_list_docker_migration_conflicting_packages_for_organizationTool(cfg), + tools_dependabot.CreateDependabot_delete_org_secretTool(cfg), + tools_dependabot.CreateDependabot_get_org_secretTool(cfg), + tools_dependabot.CreateDependabot_create_or_update_org_secretTool(cfg), + tools_packages.CreatePackages_list_packages_for_authenticated_userTool(cfg), + tools_users.CreateUsers_get_authenticatedTool(cfg), + tools_users.CreateUsers_update_authenticatedTool(cfg), + tools_billing.CreateBilling_get_shared_storage_billing_orgTool(cfg), + tools_orgs.CreateApi_insights_get_summary_statsTool(cfg), tools_repos.CreateRepos_get_community_profile_metricsTool(cfg), - tools_repos.CreateRepos_delete_releaseTool(cfg), - tools_repos.CreateRepos_get_releaseTool(cfg), - tools_repos.CreateRepos_update_releaseTool(cfg), - tools_repos.CreateRepos_get_punch_card_statsTool(cfg), - tools_dependabot.CreateDependabot_delete_repo_secretTool(cfg), - tools_dependabot.CreateDependabot_get_repo_secretTool(cfg), - tools_dependabot.CreateDependabot_create_or_update_repo_secretTool(cfg), - tools_users.CreateUsers_list_followers_for_authenticated_userTool(cfg), - tools_security_advisories.CreateSecurity_advisories_create_repository_advisory_cve_requestTool(cfg), - tools_orgs.CreateOrgs_get_org_ruleset_historyTool(cfg), - tools_orgs.CreateOrgs_list_custom_properties_values_for_reposTool(cfg), - tools_orgs.CreateOrgs_create_or_update_custom_properties_values_for_reposTool(cfg), - tools_actions.CreateActions_get_github_actions_permissions_repositoryTool(cfg), - tools_actions.CreateActions_set_github_actions_permissions_repositoryTool(cfg), - tools_activity.CreateActivity_get_feedsTool(cfg), - tools_repos.CreateRepos_get_latest_releaseTool(cfg), - tools_codespaces.CreateCodespaces_get_export_details_for_authenticated_userTool(cfg), + tools_hosted_compute.CreateHosted_compute_delete_network_configuration_from_orgTool(cfg), + tools_hosted_compute.CreateHosted_compute_get_network_configuration_for_orgTool(cfg), + tools_hosted_compute.CreateHosted_compute_update_network_configuration_for_orgTool(cfg), + tools_projects.CreateProjects_move_cardTool(cfg), + tools_interactions.CreateInteractions_remove_restrictions_for_orgTool(cfg), + tools_interactions.CreateInteractions_get_restrictions_for_orgTool(cfg), + tools_interactions.CreateInteractions_set_restrictions_for_orgTool(cfg), + tools_actions.CreateActions_list_repo_organization_variablesTool(cfg), + tools_code_scanning.CreateCode_scanning_get_default_setupTool(cfg), + tools_code_scanning.CreateCode_scanning_update_default_setupTool(cfg), tools_gists.CreateGists_list_commitsTool(cfg), - tools_repos.CreateRepos_get_repo_rulesetsTool(cfg), - tools_repos.CreateRepos_create_repo_rulesetTool(cfg), - tools_repos.CreateRepos_delete_fileTool(cfg), - tools_repos.CreateRepos_get_contentTool(cfg), - tools_repos.CreateRepos_create_or_update_file_contentsTool(cfg), - tools_codespaces.CreateCodespaces_delete_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_get_for_authenticated_userTool(cfg), - tools_codespaces.CreateCodespaces_update_for_authenticated_userTool(cfg), - tools_packages.CreatePackages_restore_package_for_orgTool(cfg), - tools_orgs.CreateOrgs_enable_or_disable_security_product_on_all_org_reposTool(cfg), - tools_interactions.CreateInteractions_remove_restrictions_for_repoTool(cfg), - tools_interactions.CreateInteractions_get_restrictions_for_repoTool(cfg), - tools_interactions.CreateInteractions_set_restrictions_for_repoTool(cfg), - tools_issues.CreateIssues_unlockTool(cfg), - tools_issues.CreateIssues_lockTool(cfg), + tools_orgs.CreateOrgs_list_security_manager_teamsTool(cfg), + tools_activity.CreateActivity_list_watchers_for_repoTool(cfg), tools_codespaces.CreateCodespaces_pre_flight_with_repo_for_authenticated_userTool(cfg), - tools_orgs.CreateOrgs_list_app_installationsTool(cfg), - tools_repos.CreateRepos_delete_branch_protectionTool(cfg), + tools_actions.CreateActions_list_jobs_for_workflow_runTool(cfg), + tools_reactions.CreateReactions_delete_for_team_discussion_commentTool(cfg), + tools_dependabot.CreateDependabot_get_org_public_keyTool(cfg), + tools_pulls.CreatePulls_submit_reviewTool(cfg), + tools_codespaces.CreateCodespaces_remove_repository_for_secret_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_add_repository_for_secret_for_authenticated_userTool(cfg), + tools_search.CreateSearch_codeTool(cfg), + tools_repos.CreateRepos_delete_deploy_keyTool(cfg), + tools_repos.CreateRepos_get_deploy_keyTool(cfg), + tools_checks.CreateChecks_rerequest_suiteTool(cfg), + tools_teams.CreateTeams_list_projects_in_orgTool(cfg), + tools_activity.CreateActivity_list_repos_watched_by_userTool(cfg), + tools_copilot.CreateCopilot_copilot_metrics_for_organizationTool(cfg), + tools_repos.CreateRepos_rename_branchTool(cfg), + tools_repos.CreateRepos_get_commitTool(cfg), + tools_copilot.CreateCopilot_get_copilot_seat_details_for_userTool(cfg), + tools_repos.CreateRepos_delete_autolinkTool(cfg), + tools_repos.CreateRepos_get_autolinkTool(cfg), + tools_meta.CreateMeta_getTool(cfg), + tools_classroom.CreateClassroom_get_a_classroomTool(cfg), + tools_repos.CreateRepos_get_deploymentTool(cfg), + tools_repos.CreateRepos_delete_deploymentTool(cfg), + tools_actions.CreateActions_get_workflow_run_attemptTool(cfg), + tools_gists.CreateGists_get_revisionTool(cfg), + tools_code_security.CreateCode_security_detach_configurationTool(cfg), + tools_actions.CreateActions_get_hosted_runners_platforms_for_orgTool(cfg), + tools_dependabot.CreateDependabot_list_org_secretsTool(cfg), + tools_repos.CreateRepos_delete_release_assetTool(cfg), + tools_repos.CreateRepos_get_release_assetTool(cfg), + tools_repos.CreateRepos_update_release_assetTool(cfg), + tools_git.CreateGit_create_refTool(cfg), + tools_teams.CreateTeams_list_repos_in_orgTool(cfg), tools_repos.CreateRepos_get_branch_protectionTool(cfg), tools_repos.CreateRepos_update_branch_protectionTool(cfg), - tools_orgs.CreateOrgs_list_org_rolesTool(cfg), - tools_repos.CreateRepos_list_tagsTool(cfg), - tools_activity.CreateActivity_list_repo_eventsTool(cfg), - tools_oidc.CreateOidc_get_oidc_custom_sub_template_for_orgTool(cfg), - tools_oidc.CreateOidc_update_oidc_custom_sub_template_for_orgTool(cfg), - tools_actions.CreateActions_review_custom_gates_for_runTool(cfg), - tools_orgs.CreateOrgs_list_pat_grant_request_repositoriesTool(cfg), - tools_repos.CreateRepos_download_zipball_archiveTool(cfg), - tools_orgs.CreateOrgs_list_webhook_deliveriesTool(cfg), - tools_repos.CreateRepos_delete_deploymentTool(cfg), - tools_repos.CreateRepos_get_deploymentTool(cfg), - tools_git.CreateGit_get_tagTool(cfg), - tools_apps.CreateApps_get_user_installationTool(cfg), + tools_repos.CreateRepos_delete_branch_protectionTool(cfg), + tools_orgs.CreateOrgs_remove_membership_for_userTool(cfg), + tools_orgs.CreateOrgs_get_membership_for_userTool(cfg), + tools_orgs.CreateOrgs_set_membership_for_userTool(cfg), + tools_actions.CreateActions_get_custom_oidc_sub_claim_for_repoTool(cfg), + tools_actions.CreateActions_set_custom_oidc_sub_claim_for_repoTool(cfg), + tools_users.CreateUsers_list_ssh_signing_keys_for_authenticated_userTool(cfg), + tools_users.CreateUsers_create_ssh_signing_key_for_authenticated_userTool(cfg), + tools_billing.CreateBilling_get_github_packages_billing_userTool(cfg), + tools_actions.CreateActions_delete_artifactTool(cfg), + tools_actions.CreateActions_get_artifactTool(cfg), + tools_orgs.CreateOrgs_enable_or_disable_security_product_on_all_org_reposTool(cfg), + tools_reactions.CreateReactions_delete_for_commit_commentTool(cfg), + tools_checks.CreateChecks_rerequest_runTool(cfg), + tools_activity.CreateActivity_list_org_events_for_authenticated_userTool(cfg), + tools_codespaces.CreateCodespaces_export_for_authenticated_userTool(cfg), + tools_users.CreateUsers_list_social_accounts_for_userTool(cfg), + tools_reactions.CreateReactions_list_for_team_discussion_legacyTool(cfg), + tools_reactions.CreateReactions_create_for_team_discussion_legacyTool(cfg), + tools_users.CreateUsers_list_attestations_bulkTool(cfg), + tools_apps.CreateApps_list_repos_accessible_to_installationTool(cfg), + tools_repos.CreateRepos_list_custom_deployment_rule_integrationsTool(cfg), + tools_code_security.CreateCode_security_attach_enterprise_configurationTool(cfg), + tools_users.CreateUsers_delete_attestations_by_subject_digestTool(cfg), + tools_actions.CreateActions_download_workflow_run_attempt_logsTool(cfg), + tools_actions.CreateActions_get_reviews_for_runTool(cfg), + tools_orgs.CreateOrgs_list_pat_grantsTool(cfg), + tools_orgs.CreateOrgs_update_pat_accessesTool(cfg), + tools_teams.CreateTeams_delete_in_orgTool(cfg), + tools_teams.CreateTeams_get_by_nameTool(cfg), + tools_teams.CreateTeams_update_in_orgTool(cfg), + tools_teams.CreateTeams_remove_member_legacyTool(cfg), + tools_teams.CreateTeams_get_member_legacyTool(cfg), + tools_teams.CreateTeams_add_member_legacyTool(cfg), + tools_projects.CreateProjects_list_columnsTool(cfg), + tools_projects.CreateProjects_create_columnTool(cfg), + tools_reactions.CreateReactions_delete_for_issueTool(cfg), + tools_repos.CreateRepos_list_deployment_statusesTool(cfg), + tools_repos.CreateRepos_create_deployment_statusTool(cfg), + tools_users.CreateUsers_list_attestationsTool(cfg), + tools_actions.CreateActions_list_runner_applications_for_orgTool(cfg), + tools_repos.CreateRepos_delete_tag_protectionTool(cfg), + tools_orgs.CreateApi_insights_get_route_stats_by_actorTool(cfg), + tools_repos.CreateRepos_delete_pull_request_review_protectionTool(cfg), + tools_repos.CreateRepos_get_pull_request_review_protectionTool(cfg), + tools_repos.CreateRepos_update_pull_request_review_protectionTool(cfg), + tools_actions.CreateActions_cancel_workflow_runTool(cfg), + tools_repos.CreateRepos_deleteTool(cfg), + tools_repos.CreateRepos_getTool(cfg), + tools_repos.CreateRepos_updateTool(cfg), + tools_actions.CreateActions_list_environment_variablesTool(cfg), + tools_actions.CreateActions_create_environment_variableTool(cfg), + tools_repos.CreateRepos_get_participation_statsTool(cfg), + tools_git.CreateGit_create_commitTool(cfg), + tools_orgs.CreateOrgs_remove_outside_collaboratorTool(cfg), + tools_orgs.CreateOrgs_convert_member_to_outside_collaboratorTool(cfg), + tools_codespaces.CreateCodespaces_set_codespaces_accessTool(cfg), + tools_repos.CreateRepos_list_autolinksTool(cfg), + tools_repos.CreateRepos_create_autolinkTool(cfg), + tools_security_advisories.CreateSecurity_advisories_create_private_vulnerability_reportTool(cfg), + tools_issues.CreateIssues_list_for_repoTool(cfg), + tools_issues.CreateIssues_createTool(cfg), + tools_repos.CreateRepos_list_publicTool(cfg), + tools_migrations.CreateMigrations_unlock_repo_for_orgTool(cfg), } } diff --git a/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_org.go index 3124cdb..df5020b 100644 --- a/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_add_custom_labels_to_self_hosted_runner_for_orgHandler(cfg *config. if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_add_custom_labels_to_self_hosted_runner_for_orgHandler(cfg *config. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels%s", cfg.BaseURL, org, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels", cfg.BaseURL, org, runner_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_repo.go b/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_repo.go index 6351092..ca5bbb9 100644 --- a/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_repo.go +++ b/MCP/go/tools/actions/actions_add_custom_labels_to_self_hosted_runner_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_add_custom_labels_to_self_hosted_runner_for_repoHandler(cfg *config if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_add_custom_labels_to_self_hosted_runner_for_repoHandler(cfg *config if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels%s", cfg.BaseURL, owner, repo, runner_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels", cfg.BaseURL, owner, repo, runner_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_add_repo_access_to_self_hosted_runner_group_in_org.go b/MCP/go/tools/actions/actions_add_repo_access_to_self_hosted_runner_group_in_org.go index 941137f..dc7ce28 100644 --- a/MCP/go/tools/actions/actions_add_repo_access_to_self_hosted_runner_group_in_org.go +++ b/MCP/go/tools/actions/actions_add_repo_access_to_self_hosted_runner_group_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_add_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *conf if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/repositories/%s%s", cfg.BaseURL, org, runner_group_id, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/repositories/%s", cfg.BaseURL, org, runner_group_id, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_add_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *conf } func CreateActions_add_repo_access_to_self_hosted_runner_group_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id_repositories_repository_id", + tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id", mcp.WithDescription("Add repository access to a self-hosted runner group in an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_add_selected_repo_to_org_secret.go b/MCP/go/tools/actions/actions_add_selected_repo_to_org_secret.go index 0cc761b..c05b697 100644 --- a/MCP/go/tools/actions/actions_add_selected_repo_to_org_secret.go +++ b/MCP/go/tools/actions/actions_add_selected_repo_to_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_add_selected_repo_to_org_secretHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s/repositories/%s%s", cfg.BaseURL, org, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s/repositories/%s", cfg.BaseURL, org, secret_name, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_add_selected_repo_to_org_secretHandler(cfg *config.APIConfig) func( } func CreateActions_add_selected_repo_to_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_actions_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("put_orgs_org_actions_secrets_secret_name_repositories", mcp.WithDescription("Add selected repository to an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/actions/actions_add_selected_repo_to_org_variable.go b/MCP/go/tools/actions/actions_add_selected_repo_to_org_variable.go index da7db39..f663f5d 100644 --- a/MCP/go/tools/actions/actions_add_selected_repo_to_org_variable.go +++ b/MCP/go/tools/actions/actions_add_selected_repo_to_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_add_selected_repo_to_org_variableHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s/repositories/%s%s", cfg.BaseURL, org, name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s/repositories/%s", cfg.BaseURL, org, name, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_add_selected_repo_to_org_variableHandler(cfg *config.APIConfig) fun } func CreateActions_add_selected_repo_to_org_variableTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_actions_variables_name_repositories_repository_id", + tool := mcp.NewTool("put_orgs_org_actions_variables_name_repositories_repository", mcp.WithDescription("Add selected repository to an organization variable"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("name", mcp.Required(), mcp.Description("The name of the variable.")), diff --git a/MCP/go/tools/actions/actions_add_self_hosted_runner_to_group_for_org.go b/MCP/go/tools/actions/actions_add_self_hosted_runner_to_group_for_org.go index a7c54f5..1dd6e85 100644 --- a/MCP/go/tools/actions/actions_add_self_hosted_runner_to_group_for_org.go +++ b/MCP/go/tools/actions/actions_add_self_hosted_runner_to_group_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_add_self_hosted_runner_to_group_for_orgHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/runners/%s%s", cfg.BaseURL, org, runner_group_id, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/runners/%s", cfg.BaseURL, org, runner_group_id, runner_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_add_self_hosted_runner_to_group_for_orgHandler(cfg *config.APIConfi } func CreateActions_add_self_hosted_runner_to_group_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id_runners_runner_id", + tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id_runners", mcp.WithDescription("Add a self-hosted runner to a group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_approve_workflow_run.go b/MCP/go/tools/actions/actions_approve_workflow_run.go index d64657b..23bf668 100644 --- a/MCP/go/tools/actions/actions_approve_workflow_run.go +++ b/MCP/go/tools/actions/actions_approve_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_approve_workflow_runHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/approve%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/approve", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_approve_workflow_runHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_cancel_workflow_run.go b/MCP/go/tools/actions/actions_cancel_workflow_run.go index 2af8acb..c4ec2c1 100644 --- a/MCP/go/tools/actions/actions_cancel_workflow_run.go +++ b/MCP/go/tools/actions/actions_cancel_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_cancel_workflow_runHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/cancel%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/cancel", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_create_environment_variable.go b/MCP/go/tools/actions/actions_create_environment_variable.go index 6dd21b9..af75f9c 100644 --- a/MCP/go/tools/actions/actions_create_environment_variable.go +++ b/MCP/go/tools/actions/actions_create_environment_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_create_environment_variableHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_create_environment_variableHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables%s", cfg.BaseURL, owner, repo, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables", cfg.BaseURL, owner, repo, environment_name) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Actions_create_environment_variableHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,13 +112,13 @@ func Actions_create_environment_variableHandler(cfg *config.APIConfig) func(ctx } func CreateActions_create_environment_variableTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_environments_environment_name_variables", + tool := mcp.NewTool("post_repos_owner_repo_environments_environment_name", mcp.WithDescription("Create an environment variable"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the variable.")), mcp.WithString("value", mcp.Required(), mcp.Description("Input parameter: The value of the variable.")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the variable.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_create_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_create_hosted_runner_for_org.go index 7067695..711f1b8 100644 --- a/MCP/go/tools/actions/actions_create_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_create_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Actions_create_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Actions_create_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Actions_create_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_hosted_runner if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_create_or_update_environment_secret.go b/MCP/go/tools/actions/actions_create_or_update_environment_secret.go index 408db41..5582fb3 100644 --- a/MCP/go/tools/actions/actions_create_or_update_environment_secret.go +++ b/MCP/go/tools/actions/actions_create_or_update_environment_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Actions_create_or_update_environment_secretHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Actions_create_or_update_environment_secretHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/%s%s", cfg.BaseURL, owner, repo, environment_name, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/%s", cfg.BaseURL, owner, repo, environment_name, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Actions_create_or_update_environment_secretHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -151,7 +120,7 @@ func Actions_create_or_update_environment_secretHandler(cfg *config.APIConfig) f } func CreateActions_create_or_update_environment_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_environments_environment_name_secrets_secret_name", + tool := mcp.NewTool("put_repos_owner_repo_environments_environment_name_secrets", mcp.WithDescription("Create or update an environment secret"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_create_or_update_org_secret.go b/MCP/go/tools/actions/actions_create_or_update_org_secret.go index f307349..c1796d3 100644 --- a/MCP/go/tools/actions/actions_create_or_update_org_secret.go +++ b/MCP/go/tools/actions/actions_create_or_update_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_create_or_update_org_secretHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_create_or_update_org_secretHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Actions_create_or_update_org_secretHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_create_or_update_repo_secret.go b/MCP/go/tools/actions/actions_create_or_update_repo_secret.go index 3e5bff1..3f5a1ce 100644 --- a/MCP/go/tools/actions/actions_create_or_update_repo_secret.go +++ b/MCP/go/tools/actions/actions_create_or_update_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_create_or_update_repo_secretHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_create_or_update_repo_secretHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Actions_create_or_update_repo_secretHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,8 +117,8 @@ func CreateActions_create_or_update_repo_secretTool(cfg *config.APIConfig) model mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), - mcp.WithString("key_id", mcp.Required(), mcp.Description("Input parameter: ID of the key you used to encrypt the secret.")), mcp.WithString("encrypted_value", mcp.Required(), mcp.Description("Input parameter: Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/actions/secrets#get-a-repository-public-key) endpoint.")), + mcp.WithString("key_id", mcp.Required(), mcp.Description("Input parameter: ID of the key you used to encrypt the secret.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_create_org_variable.go b/MCP/go/tools/actions/actions_create_org_variable.go index 0017bfe..3cc8bd0 100644 --- a/MCP/go/tools/actions/actions_create_org_variable.go +++ b/MCP/go/tools/actions/actions_create_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Actions_create_org_variableHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Actions_create_org_variableHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/variables%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Actions_create_org_variableHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,10 +99,10 @@ func CreateActions_create_org_variableTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_orgs_org_actions_variables", mcp.WithDescription("Create an organization variable"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("visibility", mcp.Required(), mcp.Description("Input parameter: The type of repositories in the organization that can access the variable. `selected` means only the repositories specified by `selected_repository_ids` can access the variable.")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the variable.")), mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository ids that can access the organization variable. You can only provide a list of repository ids when the `visibility` is set to `selected`.")), mcp.WithString("value", mcp.Required(), mcp.Description("Input parameter: The value of the variable.")), + mcp.WithString("visibility", mcp.Required(), mcp.Description("Input parameter: The type of repositories in the organization that can access the variable. `selected` means only the repositories specified by `selected_repository_ids` can access the variable.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_create_registration_token_for_org.go b/MCP/go/tools/actions/actions_create_registration_token_for_org.go index f12fb6a..911c22a 100644 --- a/MCP/go/tools/actions/actions_create_registration_token_for_org.go +++ b/MCP/go/tools/actions/actions_create_registration_token_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_create_registration_token_for_orgHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/registration-token%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/registration-token", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_create_registration_token_for_orgHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Authentication_token if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_create_registration_token_for_repo.go b/MCP/go/tools/actions/actions_create_registration_token_for_repo.go index 90b69fb..3b5b046 100644 --- a/MCP/go/tools/actions/actions_create_registration_token_for_repo.go +++ b/MCP/go/tools/actions/actions_create_registration_token_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_create_registration_token_for_repoHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/registration-token%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/registration-token", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_create_registration_token_for_repoHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Authentication_token if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_create_remove_token_for_org.go b/MCP/go/tools/actions/actions_create_remove_token_for_org.go index f90662e..c6bc9c6 100644 --- a/MCP/go/tools/actions/actions_create_remove_token_for_org.go +++ b/MCP/go/tools/actions/actions_create_remove_token_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_create_remove_token_for_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/remove-token%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/remove-token", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_create_remove_token_for_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Authentication_token if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_create_remove_token_for_repo.go b/MCP/go/tools/actions/actions_create_remove_token_for_repo.go index d9b306a..1f7d80f 100644 --- a/MCP/go/tools/actions/actions_create_remove_token_for_repo.go +++ b/MCP/go/tools/actions/actions_create_remove_token_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_create_remove_token_for_repoHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/remove-token%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/remove-token", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_create_remove_token_for_repoHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Authentication_token if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_create_repo_variable.go b/MCP/go/tools/actions/actions_create_repo_variable.go index e4fd2b1..7cfe34e 100644 --- a/MCP/go/tools/actions/actions_create_repo_variable.go +++ b/MCP/go/tools/actions/actions_create_repo_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_create_repo_variableHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_create_repo_variableHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/variables%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/variables", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Actions_create_repo_variableHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,8 +108,8 @@ func CreateActions_create_repo_variableTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a repository variable"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("value", mcp.Required(), mcp.Description("Input parameter: The value of the variable.")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the variable.")), + mcp.WithString("value", mcp.Required(), mcp.Description("Input parameter: The value of the variable.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_create_self_hosted_runner_group_for_org.go b/MCP/go/tools/actions/actions_create_self_hosted_runner_group_for_org.go index 52ef9d1..cbbce5c 100644 --- a/MCP/go/tools/actions/actions_create_self_hosted_runner_group_for_org.go +++ b/MCP/go/tools/actions/actions_create_self_hosted_runner_group_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Actions_create_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Actions_create_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Actions_create_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Runner_groups_org if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,14 +99,14 @@ func CreateActions_create_self_hosted_runner_group_for_orgTool(cfg *config.APICo tool := mcp.NewTool("post_orgs_org_actions_runner-groups", mcp.WithDescription("Create a self-hosted runner group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), + mcp.WithString("network_configuration_id", mcp.Description("Input parameter: The identifier of a hosted compute network configuration.")), + mcp.WithBoolean("restricted_to_workflows", mcp.Description("Input parameter: If `true`, the runner group will be restricted to running only the workflows specified in the `selected_workflows` array.")), + mcp.WithArray("runners", mcp.Description("Input parameter: List of runner IDs to add to the runner group.")), mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: List of repository IDs that can access the runner group.")), mcp.WithArray("selected_workflows", mcp.Description("Input parameter: List of workflows the runner group should be allowed to run. This setting will be ignored unless `restricted_to_workflows` is set to `true`.")), mcp.WithString("visibility", mcp.Description("Input parameter: Visibility of a runner group. You can select all repositories, select individual repositories, or limit access to private repositories.")), mcp.WithBoolean("allows_public_repositories", mcp.Description("Input parameter: Whether the runner group can be used by `public` repositories.")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: Name of the runner group.")), - mcp.WithString("network_configuration_id", mcp.Description("Input parameter: The identifier of a hosted compute network configuration.")), - mcp.WithBoolean("restricted_to_workflows", mcp.Description("Input parameter: If `true`, the runner group will be restricted to running only the workflows specified in the `selected_workflows` array.")), - mcp.WithArray("runners", mcp.Description("Input parameter: List of runner IDs to add to the runner group.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_create_workflow_dispatch.go b/MCP/go/tools/actions/actions_create_workflow_dispatch.go index 0fdacbb..97ced50 100644 --- a/MCP/go/tools/actions/actions_create_workflow_dispatch.go +++ b/MCP/go/tools/actions/actions_create_workflow_dispatch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_create_workflow_dispatchHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: workflow_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_create_workflow_dispatchHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/dispatches%s", cfg.BaseURL, owner, repo, workflow_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/dispatches", cfg.BaseURL, owner, repo, workflow_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Actions_create_workflow_dispatchHandler(cfg *config.APIConfig) func(ctx con } func CreateActions_create_workflow_dispatchTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_actions_workflows_workflow_id_dispatches", + tool := mcp.NewTool("post_repos_owner_repo_actions_workflows_workflow_id", mcp.WithDescription("Create a workflow dispatch event"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_delete_actions_cache_by_id.go b/MCP/go/tools/actions/actions_delete_actions_cache_by_id.go index 25800ab..3caaba5 100644 --- a/MCP/go/tools/actions/actions_delete_actions_cache_by_id.go +++ b/MCP/go/tools/actions/actions_delete_actions_cache_by_id.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_actions_cache_by_idHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: cache_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/caches/%s%s", cfg.BaseURL, owner, repo, cache_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/caches/%s", cfg.BaseURL, owner, repo, cache_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_actions_cache_by_key.go b/MCP/go/tools/actions/actions_delete_actions_cache_by_key.go index 19e6f32..82ac81a 100644 --- a/MCP/go/tools/actions/actions_delete_actions_cache_by_key.go +++ b/MCP/go/tools/actions/actions_delete_actions_cache_by_key.go @@ -42,34 +42,6 @@ func Actions_delete_actions_cache_by_keyHandler(cfg *config.APIConfig) func(ctx if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_delete_actions_cache_by_keyHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Actions_delete_actions_cache_by_keyHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_cache_list if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_delete_artifact.go b/MCP/go/tools/actions/actions_delete_artifact.go index 552daa3..bc38465 100644 --- a/MCP/go/tools/actions/actions_delete_artifact.go +++ b/MCP/go/tools/actions/actions_delete_artifact.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_artifactHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: artifact_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/artifacts/%s%s", cfg.BaseURL, owner, repo, artifact_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/artifacts/%s", cfg.BaseURL, owner, repo, artifact_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_environment_secret.go b/MCP/go/tools/actions/actions_delete_environment_secret.go index 285182d..18068fd 100644 --- a/MCP/go/tools/actions/actions_delete_environment_secret.go +++ b/MCP/go/tools/actions/actions_delete_environment_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_delete_environment_secretHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/%s%s", cfg.BaseURL, owner, repo, environment_name, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/%s", cfg.BaseURL, owner, repo, environment_name, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Actions_delete_environment_secretHandler(cfg *config.APIConfig) func(ctx co } func CreateActions_delete_environment_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name_secrets_secret_name", + tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name", mcp.WithDescription("Delete an environment secret"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_delete_environment_variable.go b/MCP/go/tools/actions/actions_delete_environment_variable.go index d449736..03b0a92 100644 --- a/MCP/go/tools/actions/actions_delete_environment_variable.go +++ b/MCP/go/tools/actions/actions_delete_environment_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_delete_environment_variableHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables/%s%s", cfg.BaseURL, owner, repo, name, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables/%s", cfg.BaseURL, owner, repo, name, environment_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Actions_delete_environment_variableHandler(cfg *config.APIConfig) func(ctx } func CreateActions_delete_environment_variableTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name_variables_name", + tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name", mcp.WithDescription("Delete an environment variable"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_delete_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_delete_hosted_runner_for_org.go index 0c805d2..e96ab8f 100644 --- a/MCP/go/tools/actions/actions_delete_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_delete_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_delete_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: hosted_runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/%s%s", cfg.BaseURL, org, hosted_runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/%s", cfg.BaseURL, org, hosted_runner_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_org_secret.go b/MCP/go/tools/actions/actions_delete_org_secret.go index 62bb875..9c08125 100644 --- a/MCP/go/tools/actions/actions_delete_org_secret.go +++ b/MCP/go/tools/actions/actions_delete_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_delete_org_secretHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_org_variable.go b/MCP/go/tools/actions/actions_delete_org_variable.go index ae6f9da..e7dfee9 100644 --- a/MCP/go/tools/actions/actions_delete_org_variable.go +++ b/MCP/go/tools/actions/actions_delete_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_delete_org_variableHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s%s", cfg.BaseURL, org, name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s", cfg.BaseURL, org, name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_repo_secret.go b/MCP/go/tools/actions/actions_delete_repo_secret.go index 6409e02..74bdcd8 100644 --- a/MCP/go/tools/actions/actions_delete_repo_secret.go +++ b/MCP/go/tools/actions/actions_delete_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_repo_secretHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_repo_variable.go b/MCP/go/tools/actions/actions_delete_repo_variable.go index d1b7375..bd8d26c 100644 --- a/MCP/go/tools/actions/actions_delete_repo_variable.go +++ b/MCP/go/tools/actions/actions_delete_repo_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_repo_variableHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/variables/%s%s", cfg.BaseURL, owner, repo, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/variables/%s", cfg.BaseURL, owner, repo, name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_org.go b/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_org.go index bc92dbf..cb336d2 100644 --- a/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_org.go +++ b/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_delete_self_hosted_runner_from_orgHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s%s", cfg.BaseURL, org, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s", cfg.BaseURL, org, runner_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_repo.go b/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_repo.go index 85af336..bb9e7e6 100644 --- a/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_repo.go +++ b/MCP/go/tools/actions/actions_delete_self_hosted_runner_from_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_self_hosted_runner_from_repoHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s%s", cfg.BaseURL, owner, repo, runner_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s", cfg.BaseURL, owner, repo, runner_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_self_hosted_runner_group_from_org.go b/MCP/go/tools/actions/actions_delete_self_hosted_runner_group_from_org.go index fd56f8b..de3f50f 100644 --- a/MCP/go/tools/actions/actions_delete_self_hosted_runner_group_from_org.go +++ b/MCP/go/tools/actions/actions_delete_self_hosted_runner_group_from_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_delete_self_hosted_runner_group_from_orgHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_group_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s%s", cfg.BaseURL, org, runner_group_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s", cfg.BaseURL, org, runner_group_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Actions_delete_self_hosted_runner_group_from_orgHandler(cfg *config.APIConf } func CreateActions_delete_self_hosted_runner_group_from_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_actions_runner-groups_runner_group_id", + tool := mcp.NewTool("delete_orgs_org_actions_runner-groups_runner_group_id_2", mcp.WithDescription("Delete a self-hosted runner group from an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_delete_workflow_run.go b/MCP/go/tools/actions/actions_delete_workflow_run.go index 8e79339..786a636 100644 --- a/MCP/go/tools/actions/actions_delete_workflow_run.go +++ b/MCP/go/tools/actions/actions_delete_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_workflow_runHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_delete_workflow_run_logs.go b/MCP/go/tools/actions/actions_delete_workflow_run_logs.go index b4887de..395e2f1 100644 --- a/MCP/go/tools/actions/actions_delete_workflow_run_logs.go +++ b/MCP/go/tools/actions/actions_delete_workflow_run_logs.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_delete_workflow_run_logsHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/logs%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/logs", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_disable_selected_repository_github_actions_organization.go b/MCP/go/tools/actions/actions_disable_selected_repository_github_actions_organization.go index fbf3ac8..f1c43a9 100644 --- a/MCP/go/tools/actions/actions_disable_selected_repository_github_actions_organization.go +++ b/MCP/go/tools/actions/actions_disable_selected_repository_github_actions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_disable_selected_repository_github_actions_organizationHandler(cfg if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/repositories/%s%s", cfg.BaseURL, org, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/repositories/%s", cfg.BaseURL, org, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Actions_disable_selected_repository_github_actions_organizationHandler(cfg } func CreateActions_disable_selected_repository_github_actions_organizationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_actions_permissions_repositories_repository_id", + tool := mcp.NewTool("delete_orgs_org_actions_permissions_repositories_repository", mcp.WithDescription("Disable a selected repository for GitHub Actions in an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("repository_id", mcp.Required(), mcp.Description("The unique identifier of the repository.")), diff --git a/MCP/go/tools/actions/actions_disable_workflow.go b/MCP/go/tools/actions/actions_disable_workflow.go index 616eabc..163ef3a 100644 --- a/MCP/go/tools/actions/actions_disable_workflow.go +++ b/MCP/go/tools/actions/actions_disable_workflow.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_disable_workflowHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: workflow_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/disable%s", cfg.BaseURL, owner, repo, workflow_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/disable", cfg.BaseURL, owner, repo, workflow_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_download_artifact.go b/MCP/go/tools/actions/actions_download_artifact.go index b72ef69..1d2619a 100644 --- a/MCP/go/tools/actions/actions_download_artifact.go +++ b/MCP/go/tools/actions/actions_download_artifact.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_download_artifactHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: archive_format"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/artifacts/%s/%s%s", cfg.BaseURL, owner, repo, artifact_id, archive_format, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/artifacts/%s/%s", cfg.BaseURL, owner, repo, artifact_id, archive_format) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Actions_download_artifactHandler(cfg *config.APIConfig) func(ctx context.Co } func CreateActions_download_artifactTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_actions_artifacts_artifact_id_archive_format", + tool := mcp.NewTool("get_repos_owner_repo_actions_artifacts_artifact_id_archive", mcp.WithDescription("Download an artifact"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_download_job_logs_for_workflow_run.go b/MCP/go/tools/actions/actions_download_job_logs_for_workflow_run.go index 52638b8..ad98d3f 100644 --- a/MCP/go/tools/actions/actions_download_job_logs_for_workflow_run.go +++ b/MCP/go/tools/actions/actions_download_job_logs_for_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_download_job_logs_for_workflow_runHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: job_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/jobs/%s/logs%s", cfg.BaseURL, owner, repo, job_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/jobs/%s/logs", cfg.BaseURL, owner, repo, job_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_download_workflow_run_attempt_logs.go b/MCP/go/tools/actions/actions_download_workflow_run_attempt_logs.go index 8131eba..82c2109 100644 --- a/MCP/go/tools/actions/actions_download_workflow_run_attempt_logs.go +++ b/MCP/go/tools/actions/actions_download_workflow_run_attempt_logs.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_download_workflow_run_attempt_logsHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: attempt_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/attempts/%s/logs%s", cfg.BaseURL, owner, repo, run_id, attempt_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/attempts/%s/logs", cfg.BaseURL, owner, repo, run_id, attempt_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Actions_download_workflow_run_attempt_logsHandler(cfg *config.APIConfig) fu } func CreateActions_download_workflow_run_attempt_logsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_actions_runs_run_id_attempts_attempt_number_logs", + tool := mcp.NewTool("get_repos_owner_repo_actions_runs_run_id_attempts_attempt", mcp.WithDescription("Download workflow run attempt logs"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_download_workflow_run_logs.go b/MCP/go/tools/actions/actions_download_workflow_run_logs.go index e590ee9..399f96c 100644 --- a/MCP/go/tools/actions/actions_download_workflow_run_logs.go +++ b/MCP/go/tools/actions/actions_download_workflow_run_logs.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_download_workflow_run_logsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/logs%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/logs", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_enable_selected_repository_github_actions_organization.go b/MCP/go/tools/actions/actions_enable_selected_repository_github_actions_organization.go index affd4e9..5f35123 100644 --- a/MCP/go/tools/actions/actions_enable_selected_repository_github_actions_organization.go +++ b/MCP/go/tools/actions/actions_enable_selected_repository_github_actions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_enable_selected_repository_github_actions_organizationHandler(cfg * if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/repositories/%s%s", cfg.BaseURL, org, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/repositories/%s", cfg.BaseURL, org, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_enable_workflow.go b/MCP/go/tools/actions/actions_enable_workflow.go index 71c9e94..d7e5947 100644 --- a/MCP/go/tools/actions/actions_enable_workflow.go +++ b/MCP/go/tools/actions/actions_enable_workflow.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_enable_workflowHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: workflow_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/enable%s", cfg.BaseURL, owner, repo, workflow_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/enable", cfg.BaseURL, owner, repo, workflow_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_force_cancel_workflow_run.go b/MCP/go/tools/actions/actions_force_cancel_workflow_run.go index 25058d0..7ee4bdd 100644 --- a/MCP/go/tools/actions/actions_force_cancel_workflow_run.go +++ b/MCP/go/tools/actions/actions_force_cancel_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_force_cancel_workflow_runHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/force-cancel%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/force-cancel", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_org.go b/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_org.go index 2e1c7ce..930b612 100644 --- a/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_org.go +++ b/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Actions_generate_runner_jitconfig_for_orgHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Actions_generate_runner_jitconfig_for_orgHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/generate-jitconfig%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/generate-jitconfig", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_repo.go b/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_repo.go index 7050688..6e4caa2 100644 --- a/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_repo.go +++ b/MCP/go/tools/actions/actions_generate_runner_jitconfig_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_generate_runner_jitconfig_for_repoHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_generate_runner_jitconfig_for_repoHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/generate-jitconfig%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/generate-jitconfig", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,10 +108,10 @@ func CreateActions_generate_runner_jitconfig_for_repoTool(cfg *config.APIConfig) mcp.WithDescription("Create configuration for a just-in-time runner for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the new runner.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Input parameter: The ID of the runner group to register the runner to.")), mcp.WithString("work_folder", mcp.Description("Input parameter: The working directory to be used for job execution, relative to the runner install directory.")), mcp.WithArray("labels", mcp.Required(), mcp.Description("Input parameter: The names of the custom labels to add to the runner. **Minimum items**: 1. **Maximum items**: 100.")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the new runner.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_get_actions_cache_list.go b/MCP/go/tools/actions/actions_get_actions_cache_list.go index cebf4f0..e8633ee 100644 --- a/MCP/go/tools/actions/actions_get_actions_cache_list.go +++ b/MCP/go/tools/actions/actions_get_actions_cache_list.go @@ -54,34 +54,6 @@ func Actions_get_actions_cache_listHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["direction"]; ok { queryParams = append(queryParams, fmt.Sprintf("direction=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -91,17 +63,20 @@ func Actions_get_actions_cache_listHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +94,7 @@ func Actions_get_actions_cache_listHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_cache_list if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_actions_cache_usage.go b/MCP/go/tools/actions/actions_get_actions_cache_usage.go index 0b724d7..bf26f48 100644 --- a/MCP/go/tools/actions/actions_get_actions_cache_usage.go +++ b/MCP/go/tools/actions/actions_get_actions_cache_usage.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_actions_cache_usageHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/cache/usage%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/cache/usage", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_actions_cache_usageHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_cache_usage_by_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_actions_cache_usage_by_repo_for_org.go b/MCP/go/tools/actions/actions_get_actions_cache_usage_by_repo_for_org.go index afe97e8..c994c34 100644 --- a/MCP/go/tools/actions/actions_get_actions_cache_usage_by_repo_for_org.go +++ b/MCP/go/tools/actions/actions_get_actions_cache_usage_by_repo_for_org.go @@ -34,34 +34,6 @@ func Actions_get_actions_cache_usage_by_repo_for_orgHandler(cfg *config.APIConfi if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Actions_get_actions_cache_usage_by_repo_for_orgHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_actions_cache_usage_for_org.go b/MCP/go/tools/actions/actions_get_actions_cache_usage_for_org.go index 3709047..1d44cc8 100644 --- a/MCP/go/tools/actions/actions_get_actions_cache_usage_for_org.go +++ b/MCP/go/tools/actions/actions_get_actions_cache_usage_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_actions_cache_usage_for_orgHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/cache/usage%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/cache/usage", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_get_actions_cache_usage_for_orgHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_cache_usage_org_enterprise if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_allowed_actions_organization.go b/MCP/go/tools/actions/actions_get_allowed_actions_organization.go index 4b1d30a..b9f53df 100644 --- a/MCP/go/tools/actions/actions_get_allowed_actions_organization.go +++ b/MCP/go/tools/actions/actions_get_allowed_actions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_allowed_actions_organizationHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/selected-actions%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/selected-actions", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_get_allowed_actions_organizationHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Selected_actions if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_allowed_actions_repository.go b/MCP/go/tools/actions/actions_get_allowed_actions_repository.go index 13a4f8e..d84ff05 100644 --- a/MCP/go/tools/actions/actions_get_allowed_actions_repository.go +++ b/MCP/go/tools/actions/actions_get_allowed_actions_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_allowed_actions_repositoryHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/selected-actions%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/selected-actions", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_allowed_actions_repositoryHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Selected_actions if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_artifact.go b/MCP/go/tools/actions/actions_get_artifact.go index ac92116..1b645d6 100644 --- a/MCP/go/tools/actions/actions_get_artifact.go +++ b/MCP/go/tools/actions/actions_get_artifact.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_artifactHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: artifact_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/artifacts/%s%s", cfg.BaseURL, owner, repo, artifact_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/artifacts/%s", cfg.BaseURL, owner, repo, artifact_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_custom_oidc_sub_claim_for_repo.go b/MCP/go/tools/actions/actions_get_custom_oidc_sub_claim_for_repo.go index 75f8952..48c15e8 100644 --- a/MCP/go/tools/actions/actions_get_custom_oidc_sub_claim_for_repo.go +++ b/MCP/go/tools/actions/actions_get_custom_oidc_sub_claim_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_custom_oidc_sub_claim_for_repoHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/oidc/customization/sub%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/oidc/customization/sub", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_custom_oidc_sub_claim_for_repoHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Oidc_custom_sub_repo if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_environment_public_key.go b/MCP/go/tools/actions/actions_get_environment_public_key.go index 34aaab8..fbe4059 100644 --- a/MCP/go/tools/actions/actions_get_environment_public_key.go +++ b/MCP/go/tools/actions/actions_get_environment_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_environment_public_keyHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/public-key%s", cfg.BaseURL, owner, repo, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/public-key", cfg.BaseURL, owner, repo, environment_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_environment_public_keyHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Actions_get_environment_public_keyHandler(cfg *config.APIConfig) func(ctx c } func CreateActions_get_environment_public_keyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_secrets_public-key", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_secrets", mcp.WithDescription("Get an environment public key"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_get_environment_secret.go b/MCP/go/tools/actions/actions_get_environment_secret.go index aa49948..4eaaa61 100644 --- a/MCP/go/tools/actions/actions_get_environment_secret.go +++ b/MCP/go/tools/actions/actions_get_environment_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_get_environment_secretHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/%s%s", cfg.BaseURL, owner, repo, environment_name, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/secrets/%s", cfg.BaseURL, owner, repo, environment_name, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Actions_get_environment_secretHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Actions_get_environment_secretHandler(cfg *config.APIConfig) func(ctx conte } func CreateActions_get_environment_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_secrets_secret_name", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_secrets", mcp.WithDescription("Get an environment secret"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_get_environment_variable.go b/MCP/go/tools/actions/actions_get_environment_variable.go index 97f4a71..6ffbadd 100644 --- a/MCP/go/tools/actions/actions_get_environment_variable.go +++ b/MCP/go/tools/actions/actions_get_environment_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_get_environment_variableHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables/%s%s", cfg.BaseURL, owner, repo, environment_name, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables/%s", cfg.BaseURL, owner, repo, environment_name, name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Actions_get_environment_variableHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_variable if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Actions_get_environment_variableHandler(cfg *config.APIConfig) func(ctx con } func CreateActions_get_environment_variableTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_variables_name", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_variables", mcp.WithDescription("Get an environment variable"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_organization.go b/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_organization.go index 0af94d1..247b74c 100644 --- a/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_organization.go +++ b/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_github_actions_default_workflow_permissions_organizationHandler if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/workflow%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/workflow", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_get_github_actions_default_workflow_permissions_organizationHandler return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_get_default_workflow_permissions if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_repository.go b/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_repository.go index c6102ef..b0b5f6d 100644 --- a/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_repository.go +++ b/MCP/go/tools/actions/actions_get_github_actions_default_workflow_permissions_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_github_actions_default_workflow_permissions_repositoryHandler(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/workflow%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/workflow", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_github_actions_default_workflow_permissions_repositoryHandler(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_get_default_workflow_permissions if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_github_actions_permissions_organization.go b/MCP/go/tools/actions/actions_get_github_actions_permissions_organization.go index 5ac668c..f81c5ef 100644 --- a/MCP/go/tools/actions/actions_get_github_actions_permissions_organization.go +++ b/MCP/go/tools/actions/actions_get_github_actions_permissions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_github_actions_permissions_organizationHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_get_github_actions_permissions_organizationHandler(cfg *config.APIC return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_organization_permissions if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_github_actions_permissions_repository.go b/MCP/go/tools/actions/actions_get_github_actions_permissions_repository.go index 1ba5c6e..a7638cb 100644 --- a/MCP/go/tools/actions/actions_get_github_actions_permissions_repository.go +++ b/MCP/go/tools/actions/actions_get_github_actions_permissions_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_github_actions_permissions_repositoryHandler(cfg *config.APICon if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_github_actions_permissions_repositoryHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_repository_permissions if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_get_hosted_runner_for_org.go index 16e85a3..74518d1 100644 --- a/MCP/go/tools/actions/actions_get_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_get_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: hosted_runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/%s%s", cfg.BaseURL, org, hosted_runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/%s", cfg.BaseURL, org, hosted_runner_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_hosted_runner if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_hosted_runners_github_owned_images_for_org.go b/MCP/go/tools/actions/actions_get_hosted_runners_github_owned_images_for_org.go index 735220b..6d4bb05 100644 --- a/MCP/go/tools/actions/actions_get_hosted_runners_github_owned_images_for_org.go +++ b/MCP/go/tools/actions/actions_get_hosted_runners_github_owned_images_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_hosted_runners_github_owned_images_for_orgHandler(cfg *config.A if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/images/github-owned%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/images/github-owned", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_hosted_runners_limits_for_org.go b/MCP/go/tools/actions/actions_get_hosted_runners_limits_for_org.go index a8e6bb8..c83e034 100644 --- a/MCP/go/tools/actions/actions_get_hosted_runners_limits_for_org.go +++ b/MCP/go/tools/actions/actions_get_hosted_runners_limits_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_hosted_runners_limits_for_orgHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/limits%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/limits", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_get_hosted_runners_limits_for_orgHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_hosted_runner_limits if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_hosted_runners_machine_specs_for_org.go b/MCP/go/tools/actions/actions_get_hosted_runners_machine_specs_for_org.go index 36f9eb2..c560687 100644 --- a/MCP/go/tools/actions/actions_get_hosted_runners_machine_specs_for_org.go +++ b/MCP/go/tools/actions/actions_get_hosted_runners_machine_specs_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_hosted_runners_machine_specs_for_orgHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/machine-sizes%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/machine-sizes", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_hosted_runners_partner_images_for_org.go b/MCP/go/tools/actions/actions_get_hosted_runners_partner_images_for_org.go index a7dd18c..0feb956 100644 --- a/MCP/go/tools/actions/actions_get_hosted_runners_partner_images_for_org.go +++ b/MCP/go/tools/actions/actions_get_hosted_runners_partner_images_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_hosted_runners_partner_images_for_orgHandler(cfg *config.APICon if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/images/partner%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/images/partner", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_hosted_runners_platforms_for_org.go b/MCP/go/tools/actions/actions_get_hosted_runners_platforms_for_org.go index ec923a8..6db7554 100644 --- a/MCP/go/tools/actions/actions_get_hosted_runners_platforms_for_org.go +++ b/MCP/go/tools/actions/actions_get_hosted_runners_platforms_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_hosted_runners_platforms_for_orgHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/platforms%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/platforms", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_job_for_workflow_run.go b/MCP/go/tools/actions/actions_get_job_for_workflow_run.go index f0db585..b2f60b0 100644 --- a/MCP/go/tools/actions/actions_get_job_for_workflow_run.go +++ b/MCP/go/tools/actions/actions_get_job_for_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_job_for_workflow_runHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: job_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/jobs/%s%s", cfg.BaseURL, owner, repo, job_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/jobs/%s", cfg.BaseURL, owner, repo, job_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_org_public_key.go b/MCP/go/tools/actions/actions_get_org_public_key.go index 604c9e9..a496751 100644 --- a/MCP/go/tools/actions/actions_get_org_public_key.go +++ b/MCP/go/tools/actions/actions_get_org_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_get_org_public_keyHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/public-key%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/public-key", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_get_org_public_keyHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_org_secret.go b/MCP/go/tools/actions/actions_get_org_secret.go index b89ace1..19dba2e 100644 --- a/MCP/go/tools/actions/actions_get_org_secret.go +++ b/MCP/go/tools/actions/actions_get_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_org_secretHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_org_secretHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_actions_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_org_variable.go b/MCP/go/tools/actions/actions_get_org_variable.go index 434c556..916e520 100644 --- a/MCP/go/tools/actions/actions_get_org_variable.go +++ b/MCP/go/tools/actions/actions_get_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_org_variableHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s%s", cfg.BaseURL, org, name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s", cfg.BaseURL, org, name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_org_variableHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_actions_variable if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_pending_deployments_for_run.go b/MCP/go/tools/actions/actions_get_pending_deployments_for_run.go index 8225535..42aa0a5 100644 --- a/MCP/go/tools/actions/actions_get_pending_deployments_for_run.go +++ b/MCP/go/tools/actions/actions_get_pending_deployments_for_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_pending_deployments_for_runHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/pending_deployments%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/pending_deployments", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_pending_deployments_for_runHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Pending_deployment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_repo_public_key.go b/MCP/go/tools/actions/actions_get_repo_public_key.go index ae6563b..c8b8c94 100644 --- a/MCP/go/tools/actions/actions_get_repo_public_key.go +++ b/MCP/go/tools/actions/actions_get_repo_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_repo_public_keyHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/public-key%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/public-key", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_repo_public_keyHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_repo_secret.go b/MCP/go/tools/actions/actions_get_repo_secret.go index b805337..1303355 100644 --- a/MCP/go/tools/actions/actions_get_repo_secret.go +++ b/MCP/go/tools/actions/actions_get_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_repo_secretHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_repo_secretHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_repo_variable.go b/MCP/go/tools/actions/actions_get_repo_variable.go index 8ec81c4..8d39682 100644 --- a/MCP/go/tools/actions/actions_get_repo_variable.go +++ b/MCP/go/tools/actions/actions_get_repo_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_repo_variableHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/variables/%s%s", cfg.BaseURL, owner, repo, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/variables/%s", cfg.BaseURL, owner, repo, name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_repo_variableHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_variable if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_reviews_for_run.go b/MCP/go/tools/actions/actions_get_reviews_for_run.go index d425e1f..dd17487 100644 --- a/MCP/go/tools/actions/actions_get_reviews_for_run.go +++ b/MCP/go/tools/actions/actions_get_reviews_for_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_reviews_for_runHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/approvals%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/approvals", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_reviews_for_runHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Environment_approvals if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_self_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_get_self_hosted_runner_for_org.go index 0668705..8dcc083 100644 --- a/MCP/go/tools/actions/actions_get_self_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_get_self_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_self_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s%s", cfg.BaseURL, org, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s", cfg.BaseURL, org, runner_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_self_hosted_runner_for_repo.go b/MCP/go/tools/actions/actions_get_self_hosted_runner_for_repo.go index 82327dd..ecd0ea2 100644 --- a/MCP/go/tools/actions/actions_get_self_hosted_runner_for_repo.go +++ b/MCP/go/tools/actions/actions_get_self_hosted_runner_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_self_hosted_runner_for_repoHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s%s", cfg.BaseURL, owner, repo, runner_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s", cfg.BaseURL, owner, repo, runner_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_self_hosted_runner_group_for_org.go b/MCP/go/tools/actions/actions_get_self_hosted_runner_group_for_org.go index 1a4d495..8c8e1f3 100644 --- a/MCP/go/tools/actions/actions_get_self_hosted_runner_group_for_org.go +++ b/MCP/go/tools/actions/actions_get_self_hosted_runner_group_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_group_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s%s", cfg.BaseURL, org, runner_group_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s", cfg.BaseURL, org, runner_group_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Runner_groups_org if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Actions_get_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfig) } func CreateActions_get_self_hosted_runner_group_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_actions_runner-groups_runner_group_id", + tool := mcp.NewTool("get_orgs_org_actions_runner-groups_runner_group_id_2", mcp.WithDescription("Get a self-hosted runner group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_get_workflow.go b/MCP/go/tools/actions/actions_get_workflow.go index a769ce1..6946667 100644 --- a/MCP/go/tools/actions/actions_get_workflow.go +++ b/MCP/go/tools/actions/actions_get_workflow.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_workflowHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: workflow_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s%s", cfg.BaseURL, owner, repo, workflow_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s", cfg.BaseURL, owner, repo, workflow_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_get_workflow_access_to_repository.go b/MCP/go/tools/actions/actions_get_workflow_access_to_repository.go index b5a0a8b..1692996 100644 --- a/MCP/go/tools/actions/actions_get_workflow_access_to_repository.go +++ b/MCP/go/tools/actions/actions_get_workflow_access_to_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_get_workflow_access_to_repositoryHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/access%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/access", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_get_workflow_access_to_repositoryHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_workflow_access_to_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_workflow_run.go b/MCP/go/tools/actions/actions_get_workflow_run.go index 5bbdcc9..8e8310e 100644 --- a/MCP/go/tools/actions/actions_get_workflow_run.go +++ b/MCP/go/tools/actions/actions_get_workflow_run.go @@ -47,34 +47,6 @@ func Actions_get_workflow_runHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["exclude_pull_requests"]; ok { queryParams = append(queryParams, fmt.Sprintf("exclude_pull_requests=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Actions_get_workflow_runHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Actions_get_workflow_runHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Workflow_run if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_workflow_run_attempt.go b/MCP/go/tools/actions/actions_get_workflow_run_attempt.go index 432da55..3ccb741 100644 --- a/MCP/go/tools/actions/actions_get_workflow_run_attempt.go +++ b/MCP/go/tools/actions/actions_get_workflow_run_attempt.go @@ -55,34 +55,6 @@ func Actions_get_workflow_run_attemptHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["exclude_pull_requests"]; ok { queryParams = append(queryParams, fmt.Sprintf("exclude_pull_requests=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -92,17 +64,20 @@ func Actions_get_workflow_run_attemptHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -120,7 +95,7 @@ func Actions_get_workflow_run_attemptHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Workflow_run if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -136,7 +111,7 @@ func Actions_get_workflow_run_attemptHandler(cfg *config.APIConfig) func(ctx con } func CreateActions_get_workflow_run_attemptTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_actions_runs_run_id_attempts_attempt_number", + tool := mcp.NewTool("get_repos_owner_repo_actions_runs_run_id_attempts_attempt", mcp.WithDescription("Get a workflow run attempt"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_get_workflow_run_usage.go b/MCP/go/tools/actions/actions_get_workflow_run_usage.go index 8434e50..f264559 100644 --- a/MCP/go/tools/actions/actions_get_workflow_run_usage.go +++ b/MCP/go/tools/actions/actions_get_workflow_run_usage.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_workflow_run_usageHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/timing%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/timing", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_workflow_run_usageHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Workflow_run_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_get_workflow_usage.go b/MCP/go/tools/actions/actions_get_workflow_usage.go index 6b979a7..459e4a1 100644 --- a/MCP/go/tools/actions/actions_get_workflow_usage.go +++ b/MCP/go/tools/actions/actions_get_workflow_usage.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_get_workflow_usageHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: workflow_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/timing%s", cfg.BaseURL, owner, repo, workflow_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/workflows/%s/timing", cfg.BaseURL, owner, repo, workflow_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Actions_get_workflow_usageHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Workflow_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_list_artifacts_for_repo.go b/MCP/go/tools/actions/actions_list_artifacts_for_repo.go index 64524a0..05f4953 100644 --- a/MCP/go/tools/actions/actions_list_artifacts_for_repo.go +++ b/MCP/go/tools/actions/actions_list_artifacts_for_repo.go @@ -45,34 +45,6 @@ func Actions_list_artifacts_for_repoHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["name"]; ok { queryParams = append(queryParams, fmt.Sprintf("name=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Actions_list_artifacts_for_repoHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_environment_secrets.go b/MCP/go/tools/actions/actions_list_environment_secrets.go index 654a4fd..ae6f0b4 100644 --- a/MCP/go/tools/actions/actions_list_environment_secrets.go +++ b/MCP/go/tools/actions/actions_list_environment_secrets.go @@ -50,34 +50,6 @@ func Actions_list_environment_secretsHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Actions_list_environment_secretsHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -131,7 +106,7 @@ func Actions_list_environment_secretsHandler(cfg *config.APIConfig) func(ctx con } func CreateActions_list_environment_secretsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_secrets", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_secrets_2", mcp.WithDescription("List environment secrets"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_list_environment_variables.go b/MCP/go/tools/actions/actions_list_environment_variables.go index 596c0f7..d9812ed 100644 --- a/MCP/go/tools/actions/actions_list_environment_variables.go +++ b/MCP/go/tools/actions/actions_list_environment_variables.go @@ -50,34 +50,6 @@ func Actions_list_environment_variablesHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Actions_list_environment_variablesHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -131,7 +106,7 @@ func Actions_list_environment_variablesHandler(cfg *config.APIConfig) func(ctx c } func CreateActions_list_environment_variablesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_variables", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_2", mcp.WithDescription("List environment variables"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_list_github_hosted_runners_in_group_for_org.go b/MCP/go/tools/actions/actions_list_github_hosted_runners_in_group_for_org.go index 53e9901..ea86821 100644 --- a/MCP/go/tools/actions/actions_list_github_hosted_runners_in_group_for_org.go +++ b/MCP/go/tools/actions/actions_list_github_hosted_runners_in_group_for_org.go @@ -42,34 +42,6 @@ func Actions_list_github_hosted_runners_in_group_for_orgHandler(cfg *config.APIC if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_github_hosted_runners_in_group_for_orgHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -123,7 +98,7 @@ func Actions_list_github_hosted_runners_in_group_for_orgHandler(cfg *config.APIC } func CreateActions_list_github_hosted_runners_in_group_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_actions_runner-groups_runner_group_id_hosted-runners", + tool := mcp.NewTool("get_orgs_org_actions_runner-groups_runner_group_id", mcp.WithDescription("List GitHub-hosted runners in a group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_list_hosted_runners_for_org.go b/MCP/go/tools/actions/actions_list_hosted_runners_for_org.go index d0fdc80..41b941b 100644 --- a/MCP/go/tools/actions/actions_list_hosted_runners_for_org.go +++ b/MCP/go/tools/actions/actions_list_hosted_runners_for_org.go @@ -34,34 +34,6 @@ func Actions_list_hosted_runners_for_orgHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Actions_list_hosted_runners_for_orgHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_jobs_for_workflow_run.go b/MCP/go/tools/actions/actions_list_jobs_for_workflow_run.go index 9ff7945..12da37c 100644 --- a/MCP/go/tools/actions/actions_list_jobs_for_workflow_run.go +++ b/MCP/go/tools/actions/actions_list_jobs_for_workflow_run.go @@ -53,34 +53,6 @@ func Actions_list_jobs_for_workflow_runHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Actions_list_jobs_for_workflow_runHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_jobs_for_workflow_run_attempt.go b/MCP/go/tools/actions/actions_list_jobs_for_workflow_run_attempt.go index f822ae6..7a8779f 100644 --- a/MCP/go/tools/actions/actions_list_jobs_for_workflow_run_attempt.go +++ b/MCP/go/tools/actions/actions_list_jobs_for_workflow_run_attempt.go @@ -58,34 +58,6 @@ func Actions_list_jobs_for_workflow_run_attemptHandler(cfg *config.APIConfig) fu if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -95,17 +67,20 @@ func Actions_list_jobs_for_workflow_run_attemptHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,7 +114,7 @@ func Actions_list_jobs_for_workflow_run_attemptHandler(cfg *config.APIConfig) fu } func CreateActions_list_jobs_for_workflow_run_attemptTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_actions_runs_run_id_attempts_attempt_number_jobs", + tool := mcp.NewTool("get_repos_owner_repo_actions_runs_run_id_attempts_attempt", mcp.WithDescription("List jobs for a workflow run attempt"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_org.go index 069c9e8..f5af281 100644 --- a/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_list_labels_for_self_hosted_runner_for_orgHandler(cfg *config.APICo if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels%s", cfg.BaseURL, org, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels", cfg.BaseURL, org, runner_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_repo.go b/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_repo.go index f6ecb5d..bc28ec8 100644 --- a/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_repo.go +++ b/MCP/go/tools/actions/actions_list_labels_for_self_hosted_runner_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_list_labels_for_self_hosted_runner_for_repoHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels%s", cfg.BaseURL, owner, repo, runner_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels", cfg.BaseURL, owner, repo, runner_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_org_secrets.go b/MCP/go/tools/actions/actions_list_org_secrets.go index a48011f..a825839 100644 --- a/MCP/go/tools/actions/actions_list_org_secrets.go +++ b/MCP/go/tools/actions/actions_list_org_secrets.go @@ -34,34 +34,6 @@ func Actions_list_org_secretsHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Actions_list_org_secretsHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_org_variables.go b/MCP/go/tools/actions/actions_list_org_variables.go index cc009a6..34eaff7 100644 --- a/MCP/go/tools/actions/actions_list_org_variables.go +++ b/MCP/go/tools/actions/actions_list_org_variables.go @@ -34,34 +34,6 @@ func Actions_list_org_variablesHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Actions_list_org_variablesHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_repo_access_to_self_hosted_runner_group_in_org.go b/MCP/go/tools/actions/actions_list_repo_access_to_self_hosted_runner_group_in_org.go index ab2b309..4067869 100644 --- a/MCP/go/tools/actions/actions_list_repo_access_to_self_hosted_runner_group_in_org.go +++ b/MCP/go/tools/actions/actions_list_repo_access_to_self_hosted_runner_group_in_org.go @@ -42,34 +42,6 @@ func Actions_list_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *con if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -123,7 +98,7 @@ func Actions_list_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *con } func CreateActions_list_repo_access_to_self_hosted_runner_group_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_actions_runner-groups_runner_group_id_repositories", + tool := mcp.NewTool("get_orgs_org_actions_runner-groups_runner_group_id", mcp.WithDescription("List repository access to a self-hosted runner group in an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_list_repo_organization_secrets.go b/MCP/go/tools/actions/actions_list_repo_organization_secrets.go index a17e8a1..778c2c9 100644 --- a/MCP/go/tools/actions/actions_list_repo_organization_secrets.go +++ b/MCP/go/tools/actions/actions_list_repo_organization_secrets.go @@ -42,34 +42,6 @@ func Actions_list_repo_organization_secretsHandler(cfg *config.APIConfig) func(c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_repo_organization_secretsHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_repo_organization_variables.go b/MCP/go/tools/actions/actions_list_repo_organization_variables.go index 7c5e89c..71d9a59 100644 --- a/MCP/go/tools/actions/actions_list_repo_organization_variables.go +++ b/MCP/go/tools/actions/actions_list_repo_organization_variables.go @@ -42,34 +42,6 @@ func Actions_list_repo_organization_variablesHandler(cfg *config.APIConfig) func if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_repo_organization_variablesHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_repo_secrets.go b/MCP/go/tools/actions/actions_list_repo_secrets.go index 9a4b527..157ee30 100644 --- a/MCP/go/tools/actions/actions_list_repo_secrets.go +++ b/MCP/go/tools/actions/actions_list_repo_secrets.go @@ -42,34 +42,6 @@ func Actions_list_repo_secretsHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_repo_secretsHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_repo_variables.go b/MCP/go/tools/actions/actions_list_repo_variables.go index 468e781..08a0efe 100644 --- a/MCP/go/tools/actions/actions_list_repo_variables.go +++ b/MCP/go/tools/actions/actions_list_repo_variables.go @@ -42,34 +42,6 @@ func Actions_list_repo_variablesHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_repo_variablesHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_repo_workflows.go b/MCP/go/tools/actions/actions_list_repo_workflows.go index 27b3e5a..7774e10 100644 --- a/MCP/go/tools/actions/actions_list_repo_workflows.go +++ b/MCP/go/tools/actions/actions_list_repo_workflows.go @@ -42,34 +42,6 @@ func Actions_list_repo_workflowsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_repo_workflowsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_runner_applications_for_org.go b/MCP/go/tools/actions/actions_list_runner_applications_for_org.go index 1bf55fe..e94a1d3 100644 --- a/MCP/go/tools/actions/actions_list_runner_applications_for_org.go +++ b/MCP/go/tools/actions/actions_list_runner_applications_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Actions_list_runner_applications_for_orgHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/downloads%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/downloads", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Actions_list_runner_applications_for_orgHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Runner_application if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_list_runner_applications_for_repo.go b/MCP/go/tools/actions/actions_list_runner_applications_for_repo.go index 04ef114..b374f68 100644 --- a/MCP/go/tools/actions/actions_list_runner_applications_for_repo.go +++ b/MCP/go/tools/actions/actions_list_runner_applications_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_list_runner_applications_for_repoHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/downloads%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/downloads", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Actions_list_runner_applications_for_repoHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Runner_application if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_list_selected_repos_for_org_secret.go b/MCP/go/tools/actions/actions_list_selected_repos_for_org_secret.go index 9caf342..02184a6 100644 --- a/MCP/go/tools/actions/actions_list_selected_repos_for_org_secret.go +++ b/MCP/go/tools/actions/actions_list_selected_repos_for_org_secret.go @@ -42,34 +42,6 @@ func Actions_list_selected_repos_for_org_secretHandler(cfg *config.APIConfig) fu if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_selected_repos_for_org_secretHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_selected_repos_for_org_variable.go b/MCP/go/tools/actions/actions_list_selected_repos_for_org_variable.go index ea7540e..9529190 100644 --- a/MCP/go/tools/actions/actions_list_selected_repos_for_org_variable.go +++ b/MCP/go/tools/actions/actions_list_selected_repos_for_org_variable.go @@ -42,34 +42,6 @@ func Actions_list_selected_repos_for_org_variableHandler(cfg *config.APIConfig) if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_selected_repos_for_org_variableHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_selected_repositories_enabled_github_actions_organization.go b/MCP/go/tools/actions/actions_list_selected_repositories_enabled_github_actions_organization.go index 3577b57..9542225 100644 --- a/MCP/go/tools/actions/actions_list_selected_repositories_enabled_github_actions_organization.go +++ b/MCP/go/tools/actions/actions_list_selected_repositories_enabled_github_actions_organization.go @@ -34,34 +34,6 @@ func Actions_list_selected_repositories_enabled_github_actions_organizationHandl if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Actions_list_selected_repositories_enabled_github_actions_organizationHandl if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_self_hosted_runner_groups_for_org.go b/MCP/go/tools/actions/actions_list_self_hosted_runner_groups_for_org.go index db75f9c..d002e29 100644 --- a/MCP/go/tools/actions/actions_list_self_hosted_runner_groups_for_org.go +++ b/MCP/go/tools/actions/actions_list_self_hosted_runner_groups_for_org.go @@ -37,34 +37,6 @@ func Actions_list_self_hosted_runner_groups_for_orgHandler(cfg *config.APIConfig if val, ok := args["visible_to_repository"]; ok { queryParams = append(queryParams, fmt.Sprintf("visible_to_repository=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Actions_list_self_hosted_runner_groups_for_orgHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_self_hosted_runners_for_org.go b/MCP/go/tools/actions/actions_list_self_hosted_runners_for_org.go index 8ab6002..b2238de 100644 --- a/MCP/go/tools/actions/actions_list_self_hosted_runners_for_org.go +++ b/MCP/go/tools/actions/actions_list_self_hosted_runners_for_org.go @@ -37,34 +37,6 @@ func Actions_list_self_hosted_runners_for_orgHandler(cfg *config.APIConfig) func if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Actions_list_self_hosted_runners_for_orgHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_self_hosted_runners_for_repo.go b/MCP/go/tools/actions/actions_list_self_hosted_runners_for_repo.go index c211c82..f734591 100644 --- a/MCP/go/tools/actions/actions_list_self_hosted_runners_for_repo.go +++ b/MCP/go/tools/actions/actions_list_self_hosted_runners_for_repo.go @@ -45,34 +45,6 @@ func Actions_list_self_hosted_runners_for_repoHandler(cfg *config.APIConfig) fun if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Actions_list_self_hosted_runners_for_repoHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_self_hosted_runners_in_group_for_org.go b/MCP/go/tools/actions/actions_list_self_hosted_runners_in_group_for_org.go index 8f92962..69bae3f 100644 --- a/MCP/go/tools/actions/actions_list_self_hosted_runners_in_group_for_org.go +++ b/MCP/go/tools/actions/actions_list_self_hosted_runners_in_group_for_org.go @@ -42,34 +42,6 @@ func Actions_list_self_hosted_runners_in_group_for_orgHandler(cfg *config.APICon if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Actions_list_self_hosted_runners_in_group_for_orgHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_workflow_run_artifacts.go b/MCP/go/tools/actions/actions_list_workflow_run_artifacts.go index 9b5a925..b532548 100644 --- a/MCP/go/tools/actions/actions_list_workflow_run_artifacts.go +++ b/MCP/go/tools/actions/actions_list_workflow_run_artifacts.go @@ -53,34 +53,6 @@ func Actions_list_workflow_run_artifactsHandler(cfg *config.APIConfig) func(ctx if val, ok := args["name"]; ok { queryParams = append(queryParams, fmt.Sprintf("name=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Actions_list_workflow_run_artifactsHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_workflow_runs.go b/MCP/go/tools/actions/actions_list_workflow_runs.go index 107c57b..804fe52 100644 --- a/MCP/go/tools/actions/actions_list_workflow_runs.go +++ b/MCP/go/tools/actions/actions_list_workflow_runs.go @@ -74,34 +74,6 @@ func Actions_list_workflow_runsHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["head_sha"]; ok { queryParams = append(queryParams, fmt.Sprintf("head_sha=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -111,17 +83,20 @@ func Actions_list_workflow_runsHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_list_workflow_runs_for_repo.go b/MCP/go/tools/actions/actions_list_workflow_runs_for_repo.go index 081975e..6bda49c 100644 --- a/MCP/go/tools/actions/actions_list_workflow_runs_for_repo.go +++ b/MCP/go/tools/actions/actions_list_workflow_runs_for_repo.go @@ -66,34 +66,6 @@ func Actions_list_workflow_runs_for_repoHandler(cfg *config.APIConfig) func(ctx if val, ok := args["head_sha"]; ok { queryParams = append(queryParams, fmt.Sprintf("head_sha=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -103,17 +75,20 @@ func Actions_list_workflow_runs_for_repoHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_re_run_job_for_workflow_run.go b/MCP/go/tools/actions/actions_re_run_job_for_workflow_run.go index 3669961..8ba14cc 100644 --- a/MCP/go/tools/actions/actions_re_run_job_for_workflow_run.go +++ b/MCP/go/tools/actions/actions_re_run_job_for_workflow_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_re_run_job_for_workflow_runHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: job_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_re_run_job_for_workflow_runHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/jobs/%s/rerun%s", cfg.BaseURL, owner, repo, job_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/jobs/%s/rerun", cfg.BaseURL, owner, repo, job_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Actions_re_run_job_for_workflow_runHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_re_run_workflow.go b/MCP/go/tools/actions/actions_re_run_workflow.go index c9c585f..155d369 100644 --- a/MCP/go/tools/actions/actions_re_run_workflow.go +++ b/MCP/go/tools/actions/actions_re_run_workflow.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_re_run_workflowHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_re_run_workflowHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/rerun%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/rerun", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Actions_re_run_workflowHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_re_run_workflow_failed_jobs.go b/MCP/go/tools/actions/actions_re_run_workflow_failed_jobs.go index 3b4c4f0..701286d 100644 --- a/MCP/go/tools/actions/actions_re_run_workflow_failed_jobs.go +++ b/MCP/go/tools/actions/actions_re_run_workflow_failed_jobs.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_re_run_workflow_failed_jobsHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_re_run_workflow_failed_jobsHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/rerun-failed-jobs%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/rerun-failed-jobs", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Actions_re_run_workflow_failed_jobsHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_org.go index aeab092..52715f4 100644 --- a/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Actions_remove_all_custom_labels_from_self_hosted_runner_for_orgHandler(cfg if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels%s", cfg.BaseURL, org, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels", cfg.BaseURL, org, runner_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_repo.go b/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_repo.go index 3234d1c..69ef565 100644 --- a/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_repo.go +++ b/MCP/go/tools/actions/actions_remove_all_custom_labels_from_self_hosted_runner_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_remove_all_custom_labels_from_self_hosted_runner_for_repoHandler(cf if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels%s", cfg.BaseURL, owner, repo, runner_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels", cfg.BaseURL, owner, repo, runner_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_org.go index f65525d..2ba9081 100644 --- a/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_remove_custom_label_from_self_hosted_runner_for_orgHandler(cfg *con if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels/%s%s", cfg.BaseURL, org, runner_id, name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels/%s", cfg.BaseURL, org, runner_id, name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_repo.go b/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_repo.go index b4d61db..f3a7f37 100644 --- a/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_repo.go +++ b/MCP/go/tools/actions/actions_remove_custom_label_from_self_hosted_runner_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Actions_remove_custom_label_from_self_hosted_runner_for_repoHandler(cfg *co if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels/%s%s", cfg.BaseURL, owner, repo, runner_id, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels/%s", cfg.BaseURL, owner, repo, runner_id, name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Actions_remove_custom_label_from_self_hosted_runner_for_repoHandler(cfg *co } func CreateActions_remove_custom_label_from_self_hosted_runner_for_repoTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_actions_runners_runner_id_labels_name", + tool := mcp.NewTool("delete_repos_owner_repo_actions_runners_runner_id_labels", mcp.WithDescription("Remove a custom label from a self-hosted runner for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_remove_repo_access_to_self_hosted_runner_group_in_org.go b/MCP/go/tools/actions/actions_remove_repo_access_to_self_hosted_runner_group_in_org.go index f3686ab..2662a7d 100644 --- a/MCP/go/tools/actions/actions_remove_repo_access_to_self_hosted_runner_group_in_org.go +++ b/MCP/go/tools/actions/actions_remove_repo_access_to_self_hosted_runner_group_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_remove_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *c if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/repositories/%s%s", cfg.BaseURL, org, runner_group_id, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/repositories/%s", cfg.BaseURL, org, runner_group_id, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_remove_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *c } func CreateActions_remove_repo_access_to_self_hosted_runner_group_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_actions_runner-groups_runner_group_id_repositories_repository_id", + tool := mcp.NewTool("delete_orgs_org_actions_runner-groups_runner_group_id", mcp.WithDescription("Remove repository access to a self-hosted runner group in an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_remove_selected_repo_from_org_secret.go b/MCP/go/tools/actions/actions_remove_selected_repo_from_org_secret.go index 1f7a3c3..0bfc81f 100644 --- a/MCP/go/tools/actions/actions_remove_selected_repo_from_org_secret.go +++ b/MCP/go/tools/actions/actions_remove_selected_repo_from_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_remove_selected_repo_from_org_secretHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s/repositories/%s%s", cfg.BaseURL, org, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s/repositories/%s", cfg.BaseURL, org, secret_name, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_remove_selected_repo_from_org_secretHandler(cfg *config.APIConfig) } func CreateActions_remove_selected_repo_from_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_actions_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("delete_orgs_org_actions_secrets_secret_name_repositories", mcp.WithDescription("Remove selected repository from an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/actions/actions_remove_selected_repo_from_org_variable.go b/MCP/go/tools/actions/actions_remove_selected_repo_from_org_variable.go index a2d1f40..9d46fa2 100644 --- a/MCP/go/tools/actions/actions_remove_selected_repo_from_org_variable.go +++ b/MCP/go/tools/actions/actions_remove_selected_repo_from_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_remove_selected_repo_from_org_variableHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s/repositories/%s%s", cfg.BaseURL, org, name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s/repositories/%s", cfg.BaseURL, org, name, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_remove_selected_repo_from_org_variableHandler(cfg *config.APIConfig } func CreateActions_remove_selected_repo_from_org_variableTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_actions_variables_name_repositories_repository_id", + tool := mcp.NewTool("delete_orgs_org_actions_variables_name_repositories", mcp.WithDescription("Remove selected repository from an organization variable"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("name", mcp.Required(), mcp.Description("The name of the variable.")), diff --git a/MCP/go/tools/actions/actions_remove_self_hosted_runner_from_group_for_org.go b/MCP/go/tools/actions/actions_remove_self_hosted_runner_from_group_for_org.go index 2492c90..0175807 100644 --- a/MCP/go/tools/actions/actions_remove_self_hosted_runner_from_group_for_org.go +++ b/MCP/go/tools/actions/actions_remove_self_hosted_runner_from_group_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Actions_remove_self_hosted_runner_from_group_for_orgHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/runners/%s%s", cfg.BaseURL, org, runner_group_id, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/runners/%s", cfg.BaseURL, org, runner_group_id, runner_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Actions_remove_self_hosted_runner_from_group_for_orgHandler(cfg *config.API } func CreateActions_remove_self_hosted_runner_from_group_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_actions_runner-groups_runner_group_id_runners_runner_id", + tool := mcp.NewTool("delete_orgs_org_actions_runner-groups_runner_group_id", mcp.WithDescription("Remove a self-hosted runner from a group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_review_custom_gates_for_run.go b/MCP/go/tools/actions/actions_review_custom_gates_for_run.go index 29f2bc4..6b804ef 100644 --- a/MCP/go/tools/actions/actions_review_custom_gates_for_run.go +++ b/MCP/go/tools/actions/actions_review_custom_gates_for_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_review_custom_gates_for_runHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Actions_review_custom_gates_for_runHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/deployment_protection_rule%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/deployment_protection_rule", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Actions_review_custom_gates_for_runHandler(cfg *config.APIConfig) func(ctx } func CreateActions_review_custom_gates_for_runTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_actions_runs_run_id_deployment_protection_rule", + tool := mcp.NewTool("post_repos_owner_repo_actions_runs_run_id_deployment", mcp.WithDescription("Review custom deployment protection rules for a workflow run"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_review_pending_deployments_for_run.go b/MCP/go/tools/actions/actions_review_pending_deployments_for_run.go index 77349db..d6e3de5 100644 --- a/MCP/go/tools/actions/actions_review_pending_deployments_for_run.go +++ b/MCP/go/tools/actions/actions_review_pending_deployments_for_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_review_pending_deployments_for_runHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_review_pending_deployments_for_runHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/pending_deployments%s", cfg.BaseURL, owner, repo, run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runs/%s/pending_deployments", cfg.BaseURL, owner, repo, run_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Actions_review_pending_deployments_for_runHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Deployment + var result []models.Deployment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Actions_review_pending_deployments_for_runHandler(cfg *config.APIConfig) fu } func CreateActions_review_pending_deployments_for_runTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_actions_runs_run_id_pending_deployments", + tool := mcp.NewTool("post_repos_owner_repo_actions_runs_run_id_pending", mcp.WithDescription("Review pending deployments for a workflow run"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/actions/actions_set_allowed_actions_organization.go b/MCP/go/tools/actions/actions_set_allowed_actions_organization.go index 1913642..e0418a4 100644 --- a/MCP/go/tools/actions/actions_set_allowed_actions_organization.go +++ b/MCP/go/tools/actions/actions_set_allowed_actions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,41 +27,8 @@ func Actions_set_allowed_actions_organizationHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Selected_actions // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -77,23 +43,26 @@ func Actions_set_allowed_actions_organizationHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/selected-actions%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/selected-actions", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -130,9 +99,9 @@ func CreateActions_set_allowed_actions_organizationTool(cfg *config.APIConfig) m tool := mcp.NewTool("put_orgs_org_actions_permissions_selected-actions", mcp.WithDescription("Set allowed actions and reusable workflows for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), + mcp.WithBoolean("verified_allowed", mcp.Description("Input parameter: Whether actions from GitHub Marketplace verified creators are allowed. Set to `true` to allow all actions by GitHub Marketplace verified creators.")), mcp.WithBoolean("github_owned_allowed", mcp.Description("Input parameter: Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization.")), mcp.WithArray("patterns_allowed", mcp.Description("Input parameter: Specifies a list of string-matching patterns to allow specific action(s) and reusable workflow(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`.\n\n> [!NOTE]\n> The `patterns_allowed` setting only applies to public repositories.")), - mcp.WithBoolean("verified_allowed", mcp.Description("Input parameter: Whether actions from GitHub Marketplace verified creators are allowed. Set to `true` to allow all actions by GitHub Marketplace verified creators.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_set_allowed_actions_repository.go b/MCP/go/tools/actions/actions_set_allowed_actions_repository.go index fd9b362..f71df84 100644 --- a/MCP/go/tools/actions/actions_set_allowed_actions_repository.go +++ b/MCP/go/tools/actions/actions_set_allowed_actions_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Actions_set_allowed_actions_repositoryHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Selected_actions // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Actions_set_allowed_actions_repositoryHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/selected-actions%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/selected-actions", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_org.go index 9e895f6..d1a6c1a 100644 --- a/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_custom_labels_for_self_hosted_runner_for_orgHandler(cfg *config if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_custom_labels_for_self_hosted_runner_for_orgHandler(cfg *config if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels%s", cfg.BaseURL, org, runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runners/%s/labels", cfg.BaseURL, org, runner_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_repo.go b/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_repo.go index ea75c02..ea04b5b 100644 --- a/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_repo.go +++ b/MCP/go/tools/actions/actions_set_custom_labels_for_self_hosted_runner_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_set_custom_labels_for_self_hosted_runner_for_repoHandler(cfg *confi if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_set_custom_labels_for_self_hosted_runner_for_repoHandler(cfg *confi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels%s", cfg.BaseURL, owner, repo, runner_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/runners/%s/labels", cfg.BaseURL, owner, repo, runner_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_custom_oidc_sub_claim_for_repo.go b/MCP/go/tools/actions/actions_set_custom_oidc_sub_claim_for_repo.go index c395b41..8b1e703 100644 --- a/MCP/go/tools/actions/actions_set_custom_oidc_sub_claim_for_repo.go +++ b/MCP/go/tools/actions/actions_set_custom_oidc_sub_claim_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_custom_oidc_sub_claim_for_repoHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_custom_oidc_sub_claim_for_repoHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/oidc/customization/sub%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/oidc/customization/sub", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Actions_set_custom_oidc_sub_claim_for_repoHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,8 +108,8 @@ func CreateActions_set_custom_oidc_sub_claim_for_repoTool(cfg *config.APIConfig) mcp.WithDescription("Set the customization template for an OIDC subject claim for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithBoolean("use_default", mcp.Required(), mcp.Description("Input parameter: Whether to use the default template or not. If `true`, the `include_claim_keys` field is ignored.")), mcp.WithArray("include_claim_keys", mcp.Description("Input parameter: Array of unique strings. Each claim key can only contain alphanumeric characters and underscores.")), + mcp.WithBoolean("use_default", mcp.Required(), mcp.Description("Input parameter: Whether to use the default template or not. If `true`, the `include_claim_keys` field is ignored.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_organization.go b/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_organization.go index 42668ca..5520eda 100644 --- a/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_organization.go +++ b/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,41 +27,8 @@ func Actions_set_github_actions_default_workflow_permissions_organizationHandler if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Actions_set_default_workflow_permissions // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -77,23 +43,26 @@ func Actions_set_github_actions_default_workflow_permissions_organizationHandler if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/workflow%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/workflow", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_repository.go b/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_repository.go index 8fd7f09..75b1730 100644 --- a/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_repository.go +++ b/MCP/go/tools/actions/actions_set_github_actions_default_workflow_permissions_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Actions_set_github_actions_default_workflow_permissions_repositoryHandler(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Actions_set_default_workflow_permissions // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Actions_set_github_actions_default_workflow_permissions_repositoryHandler(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/workflow%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/workflow", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_github_actions_permissions_organization.go b/MCP/go/tools/actions/actions_set_github_actions_permissions_organization.go index d171932..864c2ea 100644 --- a/MCP/go/tools/actions/actions_set_github_actions_permissions_organization.go +++ b/MCP/go/tools/actions/actions_set_github_actions_permissions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Actions_set_github_actions_permissions_organizationHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Actions_set_github_actions_permissions_organizationHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_github_actions_permissions_repository.go b/MCP/go/tools/actions/actions_set_github_actions_permissions_repository.go index 8335b78..e4eb1fa 100644 --- a/MCP/go/tools/actions/actions_set_github_actions_permissions_repository.go +++ b/MCP/go/tools/actions/actions_set_github_actions_permissions_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_github_actions_permissions_repositoryHandler(cfg *config.APICon if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_github_actions_permissions_repositoryHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,8 +108,8 @@ func CreateActions_set_github_actions_permissions_repositoryTool(cfg *config.API mcp.WithDescription("Set GitHub Actions permissions for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("allowed_actions", mcp.Description("Input parameter: The permissions policy that controls the actions and reusable workflows that are allowed to run.")), mcp.WithBoolean("enabled", mcp.Required(), mcp.Description("Input parameter: Whether GitHub Actions is enabled on the repository.")), + mcp.WithString("allowed_actions", mcp.Description("Input parameter: The permissions policy that controls the actions and reusable workflows that are allowed to run.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_set_repo_access_to_self_hosted_runner_group_in_org.go b/MCP/go/tools/actions/actions_set_repo_access_to_self_hosted_runner_group_in_org.go index ca6bd4b..f756503 100644 --- a/MCP/go/tools/actions/actions_set_repo_access_to_self_hosted_runner_group_in_org.go +++ b/MCP/go/tools/actions/actions_set_repo_access_to_self_hosted_runner_group_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *conf if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_group_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *conf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/repositories%s", cfg.BaseURL, org, runner_group_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/repositories", cfg.BaseURL, org, runner_group_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Actions_set_repo_access_to_self_hosted_runner_group_in_orgHandler(cfg *conf } func CreateActions_set_repo_access_to_self_hosted_runner_group_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id_repositories", + tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id", mcp.WithDescription("Set repository access for a self-hosted runner group in an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_set_selected_repos_for_org_secret.go b/MCP/go/tools/actions/actions_set_selected_repos_for_org_secret.go index fb7f079..024e731 100644 --- a/MCP/go/tools/actions/actions_set_selected_repos_for_org_secret.go +++ b/MCP/go/tools/actions/actions_set_selected_repos_for_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s/repositories%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/secrets/%s/repositories", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_selected_repos_for_org_variable.go b/MCP/go/tools/actions/actions_set_selected_repos_for_org_variable.go index 7c23849..13498da 100644 --- a/MCP/go/tools/actions/actions_set_selected_repos_for_org_variable.go +++ b/MCP/go/tools/actions/actions_set_selected_repos_for_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_selected_repos_for_org_variableHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_selected_repos_for_org_variableHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s/repositories%s", cfg.BaseURL, org, name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s/repositories", cfg.BaseURL, org, name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_selected_repositories_enabled_github_actions_organization.go b/MCP/go/tools/actions/actions_set_selected_repositories_enabled_github_actions_organization.go index bc48d47..31fbe3d 100644 --- a/MCP/go/tools/actions/actions_set_selected_repositories_enabled_github_actions_organization.go +++ b/MCP/go/tools/actions/actions_set_selected_repositories_enabled_github_actions_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Actions_set_selected_repositories_enabled_github_actions_organizationHandle if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Actions_set_selected_repositories_enabled_github_actions_organizationHandle if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/permissions/repositories%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/permissions/repositories", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_set_self_hosted_runners_in_group_for_org.go b/MCP/go/tools/actions/actions_set_self_hosted_runners_in_group_for_org.go index 8ff40c0..e047222 100644 --- a/MCP/go/tools/actions/actions_set_self_hosted_runners_in_group_for_org.go +++ b/MCP/go/tools/actions/actions_set_self_hosted_runners_in_group_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_set_self_hosted_runners_in_group_for_orgHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_group_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_set_self_hosted_runners_in_group_for_orgHandler(cfg *config.APIConf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/runners%s", cfg.BaseURL, org, runner_group_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s/runners", cfg.BaseURL, org, runner_group_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Actions_set_self_hosted_runners_in_group_for_orgHandler(cfg *config.APIConf } func CreateActions_set_self_hosted_runners_in_group_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id_runners", + tool := mcp.NewTool("put_orgs_org_actions_runner-groups_runner_group_id_runners_2", mcp.WithDescription("Set self-hosted runners in a group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), diff --git a/MCP/go/tools/actions/actions_set_workflow_access_to_repository.go b/MCP/go/tools/actions/actions_set_workflow_access_to_repository.go index f310d1d..7fe5ba1 100644 --- a/MCP/go/tools/actions/actions_set_workflow_access_to_repository.go +++ b/MCP/go/tools/actions/actions_set_workflow_access_to_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Actions_set_workflow_access_to_repositoryHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Actions_workflow_access_to_repository // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Actions_set_workflow_access_to_repositoryHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/access%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/permissions/access", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_update_environment_variable.go b/MCP/go/tools/actions/actions_update_environment_variable.go index 05bd820..2498bae 100644 --- a/MCP/go/tools/actions/actions_update_environment_variable.go +++ b/MCP/go/tools/actions/actions_update_environment_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Actions_update_environment_variableHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Actions_update_environment_variableHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables/%s%s", cfg.BaseURL, owner, repo, name, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/variables/%s", cfg.BaseURL, owner, repo, name, environment_name) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -151,14 +120,14 @@ func Actions_update_environment_variableHandler(cfg *config.APIConfig) func(ctx } func CreateActions_update_environment_variableTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_repos_owner_repo_environments_environment_name_variables_name", + tool := mcp.NewTool("patch_repos_owner_repo_environments_environment_name", mcp.WithDescription("Update an environment variable"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("name", mcp.Required(), mcp.Description("The name of the variable.")), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), - mcp.WithString("value", mcp.Description("Input parameter: The value of the variable.")), mcp.WithString("name", mcp.Description("Input parameter: The name of the variable.")), + mcp.WithString("value", mcp.Description("Input parameter: The value of the variable.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_update_hosted_runner_for_org.go b/MCP/go/tools/actions/actions_update_hosted_runner_for_org.go index 27629d2..eeb3e3c 100644 --- a/MCP/go/tools/actions/actions_update_hosted_runner_for_org.go +++ b/MCP/go/tools/actions/actions_update_hosted_runner_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_update_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: hosted_runner_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_update_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/%s%s", cfg.BaseURL, org, hosted_runner_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/hosted-runners/%s", cfg.BaseURL, org, hosted_runner_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Actions_update_hosted_runner_for_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_hosted_runner if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,10 +108,10 @@ func CreateActions_update_hosted_runner_for_orgTool(cfg *config.APIConfig) model mcp.WithDescription("Update a GitHub-hosted runner for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("hosted_runner_id", mcp.Required(), mcp.Description("Unique identifier of the GitHub-hosted runner.")), - mcp.WithBoolean("enable_static_ip", mcp.Description("Input parameter: Whether this runner should be updated with a static public IP. Note limit on account. To list limits on account, use `GET actions/hosted-runners/limits`")), mcp.WithNumber("maximum_runners", mcp.Description("Input parameter: The maximum amount of runners to scale up to. Runners will not auto-scale above this number. Use this setting to limit your cost.")), mcp.WithString("name", mcp.Description("Input parameter: Name of the runner. Must be between 1 and 64 characters and may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'.")), mcp.WithNumber("runner_group_id", mcp.Description("Input parameter: The existing runner group to add this runner to.")), + mcp.WithBoolean("enable_static_ip", mcp.Description("Input parameter: Whether this runner should be updated with a static public IP. Note limit on account. To list limits on account, use `GET actions/hosted-runners/limits`")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_update_org_variable.go b/MCP/go/tools/actions/actions_update_org_variable.go index 1941446..7a93be7 100644 --- a/MCP/go/tools/actions/actions_update_org_variable.go +++ b/MCP/go/tools/actions/actions_update_org_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_update_org_variableHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_update_org_variableHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s%s", cfg.BaseURL, org, name, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/variables/%s", cfg.BaseURL, org, name) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,10 +108,10 @@ func CreateActions_update_org_variableTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update an organization variable"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("name", mcp.Required(), mcp.Description("The name of the variable.")), - mcp.WithString("name", mcp.Description("Input parameter: The name of the variable.")), mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository ids that can access the organization variable. You can only provide a list of repository ids when the `visibility` is set to `selected`.")), mcp.WithString("value", mcp.Description("Input parameter: The value of the variable.")), mcp.WithString("visibility", mcp.Description("Input parameter: The type of repositories in the organization that can access the variable. `selected` means only the repositories specified by `selected_repository_ids` can access the variable.")), + mcp.WithString("name", mcp.Description("Input parameter: The name of the variable.")), ) return models.Tool{ diff --git a/MCP/go/tools/actions/actions_update_repo_variable.go b/MCP/go/tools/actions/actions_update_repo_variable.go index 853b538..7971238 100644 --- a/MCP/go/tools/actions/actions_update_repo_variable.go +++ b/MCP/go/tools/actions/actions_update_repo_variable.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Actions_update_repo_variableHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Actions_update_repo_variableHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/actions/variables/%s%s", cfg.BaseURL, owner, repo, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/actions/variables/%s", cfg.BaseURL, owner, repo, name) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/actions/actions_update_self_hosted_runner_group_for_org.go b/MCP/go/tools/actions/actions_update_self_hosted_runner_group_for_org.go index 4f9351b..cc1b860 100644 --- a/MCP/go/tools/actions/actions_update_self_hosted_runner_group_for_org.go +++ b/MCP/go/tools/actions/actions_update_self_hosted_runner_group_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Actions_update_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: runner_group_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Actions_update_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s%s", cfg.BaseURL, org, runner_group_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/runner-groups/%s", cfg.BaseURL, org, runner_group_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Actions_update_self_hosted_runner_group_for_orgHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Runner_groups_org if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,12 +108,12 @@ func CreateActions_update_self_hosted_runner_group_for_orgTool(cfg *config.APICo mcp.WithDescription("Update a self-hosted runner group for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("runner_group_id", mcp.Required(), mcp.Description("Unique identifier of the self-hosted runner group.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: Name of the runner group.")), - mcp.WithString("network_configuration_id", mcp.Description("Input parameter: The identifier of a hosted compute network configuration.")), - mcp.WithBoolean("restricted_to_workflows", mcp.Description("Input parameter: If `true`, the runner group will be restricted to running only the workflows specified in the `selected_workflows` array.")), mcp.WithArray("selected_workflows", mcp.Description("Input parameter: List of workflows the runner group should be allowed to run. This setting will be ignored unless `restricted_to_workflows` is set to `true`.")), mcp.WithString("visibility", mcp.Description("Input parameter: Visibility of a runner group. You can select all repositories, select individual repositories, or all private repositories.")), mcp.WithBoolean("allows_public_repositories", mcp.Description("Input parameter: Whether the runner group can be used by `public` repositories.")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: Name of the runner group.")), + mcp.WithString("network_configuration_id", mcp.Description("Input parameter: The identifier of a hosted compute network configuration.")), + mcp.WithBoolean("restricted_to_workflows", mcp.Description("Input parameter: If `true`, the runner group will be restricted to running only the workflows specified in the `selected_workflows` array.")), ) return models.Tool{ diff --git a/MCP/go/tools/activity/activity_check_repo_is_starred_by_authenticated_user.go b/MCP/go/tools/activity/activity_check_repo_is_starred_by_authenticated_user.go index 5e79a23..f569d36 100644 --- a/MCP/go/tools/activity/activity_check_repo_is_starred_by_authenticated_user.go +++ b/MCP/go/tools/activity/activity_check_repo_is_starred_by_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Activity_check_repo_is_starred_by_authenticated_userHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/starred/%s/%s%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/user/starred/%s/%s", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_delete_repo_subscription.go b/MCP/go/tools/activity/activity_delete_repo_subscription.go index bd2329b..6172c2b 100644 --- a/MCP/go/tools/activity/activity_delete_repo_subscription.go +++ b/MCP/go/tools/activity/activity_delete_repo_subscription.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Activity_delete_repo_subscriptionHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/subscription%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/subscription", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_delete_thread_subscription.go b/MCP/go/tools/activity/activity_delete_thread_subscription.go index 376a982..de8cdfa 100644 --- a/MCP/go/tools/activity/activity_delete_thread_subscription.go +++ b/MCP/go/tools/activity/activity_delete_thread_subscription.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Activity_delete_thread_subscriptionHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: thread_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/notifications/threads/%s/subscription%s", cfg.BaseURL, thread_id, queryString) + url := fmt.Sprintf("%s/notifications/threads/%s/subscription", cfg.BaseURL, thread_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_get_feeds.go b/MCP/go/tools/activity/activity_get_feeds.go index da1fd13..2b2f546 100644 --- a/MCP/go/tools/activity/activity_get_feeds.go +++ b/MCP/go/tools/activity/activity_get_feeds.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Activity_get_feedsHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/feeds%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/feeds", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_get_repo_subscription.go b/MCP/go/tools/activity/activity_get_repo_subscription.go index 906994e..3c29deb 100644 --- a/MCP/go/tools/activity/activity_get_repo_subscription.go +++ b/MCP/go/tools/activity/activity_get_repo_subscription.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Activity_get_repo_subscriptionHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/subscription%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/subscription", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Activity_get_repo_subscriptionHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_subscription if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_get_thread.go b/MCP/go/tools/activity/activity_get_thread.go index 9b28358..45d74ff 100644 --- a/MCP/go/tools/activity/activity_get_thread.go +++ b/MCP/go/tools/activity/activity_get_thread.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Activity_get_threadHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: thread_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/notifications/threads/%s%s", cfg.BaseURL, thread_id, queryString) + url := fmt.Sprintf("%s/notifications/threads/%s", cfg.BaseURL, thread_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_get_thread_subscription_for_authenticated_user.go b/MCP/go/tools/activity/activity_get_thread_subscription_for_authenticated_user.go index 2e29234..fd4b1f1 100644 --- a/MCP/go/tools/activity/activity_get_thread_subscription_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_get_thread_subscription_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Activity_get_thread_subscription_for_authenticated_userHandler(cfg *config. if !ok { return mcp.NewToolResultError("Invalid path parameter: thread_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/notifications/threads/%s/subscription%s", cfg.BaseURL, thread_id, queryString) + url := fmt.Sprintf("%s/notifications/threads/%s/subscription", cfg.BaseURL, thread_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Activity_get_thread_subscription_for_authenticated_userHandler(cfg *config. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Thread_subscription if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_events_for_authenticated_user.go b/MCP/go/tools/activity/activity_list_events_for_authenticated_user.go index e0671eb..d835ded 100644 --- a/MCP/go/tools/activity/activity_list_events_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_list_events_for_authenticated_user.go @@ -34,34 +34,6 @@ func Activity_list_events_for_authenticated_userHandler(cfg *config.APIConfig) f if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Activity_list_events_for_authenticated_userHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Activity_list_events_for_authenticated_userHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_notifications_for_authenticated_user.go b/MCP/go/tools/activity/activity_list_notifications_for_authenticated_user.go index decf9f0..c72609a 100644 --- a/MCP/go/tools/activity/activity_list_notifications_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_list_notifications_for_authenticated_user.go @@ -38,34 +38,6 @@ func Activity_list_notifications_for_authenticated_userHandler(cfg *config.APICo if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -75,17 +47,20 @@ func Activity_list_notifications_for_authenticated_userHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +78,7 @@ func Activity_list_notifications_for_authenticated_userHandler(cfg *config.APICo return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Thread + var result []models.Thread if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_org_events_for_authenticated_user.go b/MCP/go/tools/activity/activity_list_org_events_for_authenticated_user.go index 252f8fd..48bacb6 100644 --- a/MCP/go/tools/activity/activity_list_org_events_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_list_org_events_for_authenticated_user.go @@ -42,34 +42,6 @@ func Activity_list_org_events_for_authenticated_userHandler(cfg *config.APIConfi if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Activity_list_org_events_for_authenticated_userHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Activity_list_org_events_for_authenticated_userHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_public_events.go b/MCP/go/tools/activity/activity_list_public_events.go index 0e29f03..7433deb 100644 --- a/MCP/go/tools/activity/activity_list_public_events.go +++ b/MCP/go/tools/activity/activity_list_public_events.go @@ -26,34 +26,6 @@ func Activity_list_public_eventsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Activity_list_public_eventsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Activity_list_public_eventsHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_public_events_for_repo_network.go b/MCP/go/tools/activity/activity_list_public_events_for_repo_network.go index 8a1536e..db99595 100644 --- a/MCP/go/tools/activity/activity_list_public_events_for_repo_network.go +++ b/MCP/go/tools/activity/activity_list_public_events_for_repo_network.go @@ -42,34 +42,6 @@ func Activity_list_public_events_for_repo_networkHandler(cfg *config.APIConfig) if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Activity_list_public_events_for_repo_networkHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Activity_list_public_events_for_repo_networkHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_public_events_for_user.go b/MCP/go/tools/activity/activity_list_public_events_for_user.go index 5752819..b88beaa 100644 --- a/MCP/go/tools/activity/activity_list_public_events_for_user.go +++ b/MCP/go/tools/activity/activity_list_public_events_for_user.go @@ -34,34 +34,6 @@ func Activity_list_public_events_for_userHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Activity_list_public_events_for_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Activity_list_public_events_for_userHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_public_org_events.go b/MCP/go/tools/activity/activity_list_public_org_events.go index 90f39d8..b60d85f 100644 --- a/MCP/go/tools/activity/activity_list_public_org_events.go +++ b/MCP/go/tools/activity/activity_list_public_org_events.go @@ -34,34 +34,6 @@ func Activity_list_public_org_eventsHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Activity_list_public_org_eventsHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Activity_list_public_org_eventsHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_received_events_for_user.go b/MCP/go/tools/activity/activity_list_received_events_for_user.go index c680db3..e5edb52 100644 --- a/MCP/go/tools/activity/activity_list_received_events_for_user.go +++ b/MCP/go/tools/activity/activity_list_received_events_for_user.go @@ -34,34 +34,6 @@ func Activity_list_received_events_for_userHandler(cfg *config.APIConfig) func(c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Activity_list_received_events_for_userHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Activity_list_received_events_for_userHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_received_public_events_for_user.go b/MCP/go/tools/activity/activity_list_received_public_events_for_user.go index ad066d2..de92b27 100644 --- a/MCP/go/tools/activity/activity_list_received_public_events_for_user.go +++ b/MCP/go/tools/activity/activity_list_received_public_events_for_user.go @@ -34,34 +34,6 @@ func Activity_list_received_public_events_for_userHandler(cfg *config.APIConfig) if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Activity_list_received_public_events_for_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Activity_list_received_public_events_for_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_repo_events.go b/MCP/go/tools/activity/activity_list_repo_events.go index f65a3e7..ae951a2 100644 --- a/MCP/go/tools/activity/activity_list_repo_events.go +++ b/MCP/go/tools/activity/activity_list_repo_events.go @@ -42,34 +42,6 @@ func Activity_list_repo_eventsHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Activity_list_repo_eventsHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Activity_list_repo_eventsHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Event + var result []models.Event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_repo_notifications_for_authenticated_user.go b/MCP/go/tools/activity/activity_list_repo_notifications_for_authenticated_user.go index 7db5408..50dd26c 100644 --- a/MCP/go/tools/activity/activity_list_repo_notifications_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_list_repo_notifications_for_authenticated_user.go @@ -54,34 +54,6 @@ func Activity_list_repo_notifications_for_authenticated_userHandler(cfg *config. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -91,17 +63,20 @@ func Activity_list_repo_notifications_for_authenticated_userHandler(cfg *config. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +94,7 @@ func Activity_list_repo_notifications_for_authenticated_userHandler(cfg *config. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Thread + var result []models.Thread if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_repos_starred_by_authenticated_user.go b/MCP/go/tools/activity/activity_list_repos_starred_by_authenticated_user.go index a03f058..5aa58e9 100644 --- a/MCP/go/tools/activity/activity_list_repos_starred_by_authenticated_user.go +++ b/MCP/go/tools/activity/activity_list_repos_starred_by_authenticated_user.go @@ -32,34 +32,6 @@ func Activity_list_repos_starred_by_authenticated_userHandler(cfg *config.APICon if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -69,17 +41,20 @@ func Activity_list_repos_starred_by_authenticated_userHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -97,7 +72,7 @@ func Activity_list_repos_starred_by_authenticated_userHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Repository + var result []models.Repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_repos_starred_by_user.go b/MCP/go/tools/activity/activity_list_repos_starred_by_user.go index fc81f66..b5bbbfa 100644 --- a/MCP/go/tools/activity/activity_list_repos_starred_by_user.go +++ b/MCP/go/tools/activity/activity_list_repos_starred_by_user.go @@ -40,34 +40,6 @@ func Activity_list_repos_starred_by_userHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Activity_list_repos_starred_by_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_list_repos_watched_by_user.go b/MCP/go/tools/activity/activity_list_repos_watched_by_user.go index 08437ff..69c9cde 100644 --- a/MCP/go/tools/activity/activity_list_repos_watched_by_user.go +++ b/MCP/go/tools/activity/activity_list_repos_watched_by_user.go @@ -34,34 +34,6 @@ func Activity_list_repos_watched_by_userHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Activity_list_repos_watched_by_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Activity_list_repos_watched_by_userHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_stargazers_for_repo.go b/MCP/go/tools/activity/activity_list_stargazers_for_repo.go index 731103f..09dea29 100644 --- a/MCP/go/tools/activity/activity_list_stargazers_for_repo.go +++ b/MCP/go/tools/activity/activity_list_stargazers_for_repo.go @@ -42,34 +42,6 @@ func Activity_list_stargazers_for_repoHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Activity_list_stargazers_for_repoHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_list_watched_repos_for_authenticated_user.go b/MCP/go/tools/activity/activity_list_watched_repos_for_authenticated_user.go index 164c7d5..9470de5 100644 --- a/MCP/go/tools/activity/activity_list_watched_repos_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_list_watched_repos_for_authenticated_user.go @@ -26,34 +26,6 @@ func Activity_list_watched_repos_for_authenticated_userHandler(cfg *config.APICo if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Activity_list_watched_repos_for_authenticated_userHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Activity_list_watched_repos_for_authenticated_userHandler(cfg *config.APICo return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_list_watchers_for_repo.go b/MCP/go/tools/activity/activity_list_watchers_for_repo.go index 76a912d..ce6459b 100644 --- a/MCP/go/tools/activity/activity_list_watchers_for_repo.go +++ b/MCP/go/tools/activity/activity_list_watchers_for_repo.go @@ -42,34 +42,6 @@ func Activity_list_watchers_for_repoHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Activity_list_watchers_for_repoHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Activity_list_watchers_for_repoHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_mark_notifications_as_read.go b/MCP/go/tools/activity/activity_mark_notifications_as_read.go index da616f5..6c8430d 100644 --- a/MCP/go/tools/activity/activity_mark_notifications_as_read.go +++ b/MCP/go/tools/activity/activity_mark_notifications_as_read.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Activity_mark_notifications_as_readHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Activity_mark_notifications_as_readHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/notifications%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/notifications", cfg.BaseURL) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_mark_repo_notifications_as_read.go b/MCP/go/tools/activity/activity_mark_repo_notifications_as_read.go index 73a4115..0233b11 100644 --- a/MCP/go/tools/activity/activity_mark_repo_notifications_as_read.go +++ b/MCP/go/tools/activity/activity_mark_repo_notifications_as_read.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Activity_mark_repo_notifications_as_readHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Activity_mark_repo_notifications_as_readHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/notifications%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/notifications", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_mark_thread_as_done.go b/MCP/go/tools/activity/activity_mark_thread_as_done.go index 087d871..a97d67f 100644 --- a/MCP/go/tools/activity/activity_mark_thread_as_done.go +++ b/MCP/go/tools/activity/activity_mark_thread_as_done.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Activity_mark_thread_as_doneHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: thread_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/notifications/threads/%s%s", cfg.BaseURL, thread_id, queryString) + url := fmt.Sprintf("%s/notifications/threads/%s", cfg.BaseURL, thread_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_mark_thread_as_read.go b/MCP/go/tools/activity/activity_mark_thread_as_read.go index 9350827..84fd586 100644 --- a/MCP/go/tools/activity/activity_mark_thread_as_read.go +++ b/MCP/go/tools/activity/activity_mark_thread_as_read.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Activity_mark_thread_as_readHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: thread_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/notifications/threads/%s%s", cfg.BaseURL, thread_id, queryString) + url := fmt.Sprintf("%s/notifications/threads/%s", cfg.BaseURL, thread_id) req, err := http.NewRequest("PATCH", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_set_repo_subscription.go b/MCP/go/tools/activity/activity_set_repo_subscription.go index aeae4b6..acd7f15 100644 --- a/MCP/go/tools/activity/activity_set_repo_subscription.go +++ b/MCP/go/tools/activity/activity_set_repo_subscription.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Activity_set_repo_subscriptionHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Activity_set_repo_subscriptionHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/subscription%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/subscription", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Activity_set_repo_subscriptionHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_subscription if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_set_thread_subscription.go b/MCP/go/tools/activity/activity_set_thread_subscription.go index d4d66e6..f8f49d5 100644 --- a/MCP/go/tools/activity/activity_set_thread_subscription.go +++ b/MCP/go/tools/activity/activity_set_thread_subscription.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Activity_set_thread_subscriptionHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: thread_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Activity_set_thread_subscriptionHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/notifications/threads/%s/subscription%s", cfg.BaseURL, thread_id, queryString) + url := fmt.Sprintf("%s/notifications/threads/%s/subscription", cfg.BaseURL, thread_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Activity_set_thread_subscriptionHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Thread_subscription if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/activity/activity_star_repo_for_authenticated_user.go b/MCP/go/tools/activity/activity_star_repo_for_authenticated_user.go index 55a963c..1d58aa1 100644 --- a/MCP/go/tools/activity/activity_star_repo_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_star_repo_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Activity_star_repo_for_authenticated_userHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/starred/%s/%s%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/user/starred/%s/%s", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/activity/activity_unstar_repo_for_authenticated_user.go b/MCP/go/tools/activity/activity_unstar_repo_for_authenticated_user.go index 1166ff5..c12c64a 100644 --- a/MCP/go/tools/activity/activity_unstar_repo_for_authenticated_user.go +++ b/MCP/go/tools/activity/activity_unstar_repo_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Activity_unstar_repo_for_authenticated_userHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/starred/%s/%s%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/user/starred/%s/%s", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_add_repo_to_installation_for_authenticated_user.go b/MCP/go/tools/apps/apps_add_repo_to_installation_for_authenticated_user.go index 10b2cc9..af94f0a 100644 --- a/MCP/go/tools/apps/apps_add_repo_to_installation_for_authenticated_user.go +++ b/MCP/go/tools/apps/apps_add_repo_to_installation_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Apps_add_repo_to_installation_for_authenticated_userHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/installations/%s/repositories/%s%s", cfg.BaseURL, installation_id, repository_id, queryString) + url := fmt.Sprintf("%s/user/installations/%s/repositories/%s", cfg.BaseURL, installation_id, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Apps_add_repo_to_installation_for_authenticated_userHandler(cfg *config.API } func CreateApps_add_repo_to_installation_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_user_installations_installation_id_repositories_repository_id", + tool := mcp.NewTool("put_user_installations_installation_id_repositories", mcp.WithDescription("Add a repository to an app installation"), mcp.WithNumber("installation_id", mcp.Required(), mcp.Description("The unique identifier of the installation.")), mcp.WithNumber("repository_id", mcp.Required(), mcp.Description("The unique identifier of the repository.")), diff --git a/MCP/go/tools/apps/apps_check_token.go b/MCP/go/tools/apps/apps_check_token.go index 347b4ab..22a7b7b 100644 --- a/MCP/go/tools/apps/apps_check_token.go +++ b/MCP/go/tools/apps/apps_check_token.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Apps_check_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: client_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Apps_check_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/applications/%s/token%s", cfg.BaseURL, client_id, queryString) + url := fmt.Sprintf("%s/applications/%s/token", cfg.BaseURL, client_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_create_from_manifest.go b/MCP/go/tools/apps/apps_create_from_manifest.go index 6190542..e11c074 100644 --- a/MCP/go/tools/apps/apps_create_from_manifest.go +++ b/MCP/go/tools/apps/apps_create_from_manifest.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_create_from_manifestHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: code"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app-manifests/%s/conversions%s", cfg.BaseURL, code, queryString) + url := fmt.Sprintf("%s/app-manifests/%s/conversions", cfg.BaseURL, code) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_create_installation_access_token.go b/MCP/go/tools/apps/apps_create_installation_access_token.go index 2dabff2..c29682a 100644 --- a/MCP/go/tools/apps/apps_create_installation_access_token.go +++ b/MCP/go/tools/apps/apps_create_installation_access_token.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Apps_create_installation_access_tokenHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: installation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Apps_create_installation_access_tokenHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/app/installations/%s/access_tokens%s", cfg.BaseURL, installation_id, queryString) + url := fmt.Sprintf("%s/app/installations/%s/access_tokens", cfg.BaseURL, installation_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Apps_create_installation_access_tokenHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Installation_token if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_delete_authorization.go b/MCP/go/tools/apps/apps_delete_authorization.go index 28af320..f0803b8 100644 --- a/MCP/go/tools/apps/apps_delete_authorization.go +++ b/MCP/go/tools/apps/apps_delete_authorization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Apps_delete_authorizationHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: client_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Apps_delete_authorizationHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/applications/%s/grant%s", cfg.BaseURL, client_id, queryString) + url := fmt.Sprintf("%s/applications/%s/grant", cfg.BaseURL, client_id) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_delete_installation.go b/MCP/go/tools/apps/apps_delete_installation.go index 95b81a5..cc3c569 100644 --- a/MCP/go/tools/apps/apps_delete_installation.go +++ b/MCP/go/tools/apps/apps_delete_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_delete_installationHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: installation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/installations/%s%s", cfg.BaseURL, installation_id, queryString) + url := fmt.Sprintf("%s/app/installations/%s", cfg.BaseURL, installation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_delete_token.go b/MCP/go/tools/apps/apps_delete_token.go index 82629b5..f7e4fef 100644 --- a/MCP/go/tools/apps/apps_delete_token.go +++ b/MCP/go/tools/apps/apps_delete_token.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Apps_delete_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: client_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Apps_delete_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/applications/%s/token%s", cfg.BaseURL, client_id, queryString) + url := fmt.Sprintf("%s/applications/%s/token", cfg.BaseURL, client_id) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_authenticated.go b/MCP/go/tools/apps/apps_get_authenticated.go index b4f62b9..8786ab6 100644 --- a/MCP/go/tools/apps/apps_get_authenticated.go +++ b/MCP/go/tools/apps/apps_get_authenticated.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Apps_get_authenticatedHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/app", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_by_slug.go b/MCP/go/tools/apps/apps_get_by_slug.go index acf5618..ac33d89 100644 --- a/MCP/go/tools/apps/apps_get_by_slug.go +++ b/MCP/go/tools/apps/apps_get_by_slug.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_by_slugHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: app_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/apps/%s%s", cfg.BaseURL, app_slug, queryString) + url := fmt.Sprintf("%s/apps/%s", cfg.BaseURL, app_slug) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_installation.go b/MCP/go/tools/apps/apps_get_installation.go index f8c74b5..c53405d 100644 --- a/MCP/go/tools/apps/apps_get_installation.go +++ b/MCP/go/tools/apps/apps_get_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_installationHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: installation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/installations/%s%s", cfg.BaseURL, installation_id, queryString) + url := fmt.Sprintf("%s/app/installations/%s", cfg.BaseURL, installation_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_org_installation.go b/MCP/go/tools/apps/apps_get_org_installation.go index 45ca893..fb5b4aa 100644 --- a/MCP/go/tools/apps/apps_get_org_installation.go +++ b/MCP/go/tools/apps/apps_get_org_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_org_installationHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/installation%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/installation", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_repo_installation.go b/MCP/go/tools/apps/apps_get_repo_installation.go index 16c3be2..424b603 100644 --- a/MCP/go/tools/apps/apps_get_repo_installation.go +++ b/MCP/go/tools/apps/apps_get_repo_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Apps_get_repo_installationHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/installation%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/installation", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_subscription_plan_for_account.go b/MCP/go/tools/apps/apps_get_subscription_plan_for_account.go index 5a165db..910552f 100644 --- a/MCP/go/tools/apps/apps_get_subscription_plan_for_account.go +++ b/MCP/go/tools/apps/apps_get_subscription_plan_for_account.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_subscription_plan_for_accountHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: account_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/marketplace_listing/accounts/%s%s", cfg.BaseURL, account_id, queryString) + url := fmt.Sprintf("%s/marketplace_listing/accounts/%s", cfg.BaseURL, account_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Apps_get_subscription_plan_for_accountHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Marketplace_purchase if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_get_subscription_plan_for_account_stubbed.go b/MCP/go/tools/apps/apps_get_subscription_plan_for_account_stubbed.go index bad7a49..d73ab98 100644 --- a/MCP/go/tools/apps/apps_get_subscription_plan_for_account_stubbed.go +++ b/MCP/go/tools/apps/apps_get_subscription_plan_for_account_stubbed.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_subscription_plan_for_account_stubbedHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: account_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/marketplace_listing/stubbed/accounts/%s%s", cfg.BaseURL, account_id, queryString) + url := fmt.Sprintf("%s/marketplace_listing/stubbed/accounts/%s", cfg.BaseURL, account_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Apps_get_subscription_plan_for_account_stubbedHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Marketplace_purchase if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_get_user_installation.go b/MCP/go/tools/apps/apps_get_user_installation.go index 976f265..6f7d720 100644 --- a/MCP/go/tools/apps/apps_get_user_installation.go +++ b/MCP/go/tools/apps/apps_get_user_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_user_installationHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/installation%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s/installation", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_get_webhook_config_for_app.go b/MCP/go/tools/apps/apps_get_webhook_config_for_app.go index dca6c24..5f3a657 100644 --- a/MCP/go/tools/apps/apps_get_webhook_config_for_app.go +++ b/MCP/go/tools/apps/apps_get_webhook_config_for_app.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Apps_get_webhook_config_for_appHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/hook/config%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/app/hook/config", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -81,7 +50,7 @@ func Apps_get_webhook_config_for_appHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Webhook_config if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_get_webhook_delivery.go b/MCP/go/tools/apps/apps_get_webhook_delivery.go index 0ebf3e8..fe1ae95 100644 --- a/MCP/go/tools/apps/apps_get_webhook_delivery.go +++ b/MCP/go/tools/apps/apps_get_webhook_delivery.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: delivery_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/hook/deliveries/%s%s", cfg.BaseURL, delivery_id, queryString) + url := fmt.Sprintf("%s/app/hook/deliveries/%s", cfg.BaseURL, delivery_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Apps_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Hook_delivery if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_accounts_for_plan.go b/MCP/go/tools/apps/apps_list_accounts_for_plan.go index ec774eb..fb652cb 100644 --- a/MCP/go/tools/apps/apps_list_accounts_for_plan.go +++ b/MCP/go/tools/apps/apps_list_accounts_for_plan.go @@ -40,34 +40,6 @@ func Apps_list_accounts_for_planHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Apps_list_accounts_for_planHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Apps_list_accounts_for_planHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Marketplace_purchase if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_accounts_for_plan_stubbed.go b/MCP/go/tools/apps/apps_list_accounts_for_plan_stubbed.go index 52de05e..4c1753d 100644 --- a/MCP/go/tools/apps/apps_list_accounts_for_plan_stubbed.go +++ b/MCP/go/tools/apps/apps_list_accounts_for_plan_stubbed.go @@ -40,34 +40,6 @@ func Apps_list_accounts_for_plan_stubbedHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Apps_list_accounts_for_plan_stubbedHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Apps_list_accounts_for_plan_stubbedHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Marketplace_purchase if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_installation_repos_for_authenticated_user.go b/MCP/go/tools/apps/apps_list_installation_repos_for_authenticated_user.go index e00a48f..af951cf 100644 --- a/MCP/go/tools/apps/apps_list_installation_repos_for_authenticated_user.go +++ b/MCP/go/tools/apps/apps_list_installation_repos_for_authenticated_user.go @@ -34,34 +34,6 @@ func Apps_list_installation_repos_for_authenticated_userHandler(cfg *config.APIC if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Apps_list_installation_repos_for_authenticated_userHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_list_installation_requests_for_authenticated_app.go b/MCP/go/tools/apps/apps_list_installation_requests_for_authenticated_app.go index bd92920..b6ea97d 100644 --- a/MCP/go/tools/apps/apps_list_installation_requests_for_authenticated_app.go +++ b/MCP/go/tools/apps/apps_list_installation_requests_for_authenticated_app.go @@ -26,34 +26,6 @@ func Apps_list_installation_requests_for_authenticated_appHandler(cfg *config.AP if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_installation_requests_for_authenticated_appHandler(cfg *config.AP if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Apps_list_installation_requests_for_authenticated_appHandler(cfg *config.AP return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Integration_installation_request if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_installations.go b/MCP/go/tools/apps/apps_list_installations.go index bdd7e62..431c4c8 100644 --- a/MCP/go/tools/apps/apps_list_installations.go +++ b/MCP/go/tools/apps/apps_list_installations.go @@ -32,34 +32,6 @@ func Apps_list_installationsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["outdated"]; ok { queryParams = append(queryParams, fmt.Sprintf("outdated=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -69,17 +41,20 @@ func Apps_list_installationsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -97,7 +72,7 @@ func Apps_list_installationsHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Installation + var result []models.Installation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_installations_for_authenticated_user.go b/MCP/go/tools/apps/apps_list_installations_for_authenticated_user.go index 1031b71..fd3ecc1 100644 --- a/MCP/go/tools/apps/apps_list_installations_for_authenticated_user.go +++ b/MCP/go/tools/apps/apps_list_installations_for_authenticated_user.go @@ -26,34 +26,6 @@ func Apps_list_installations_for_authenticated_userHandler(cfg *config.APIConfig if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_installations_for_authenticated_userHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_list_plans.go b/MCP/go/tools/apps/apps_list_plans.go index 0c2ad06..9428aca 100644 --- a/MCP/go/tools/apps/apps_list_plans.go +++ b/MCP/go/tools/apps/apps_list_plans.go @@ -26,34 +26,6 @@ func Apps_list_plansHandler(cfg *config.APIConfig) func(ctx context.Context, req if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_plansHandler(cfg *config.APIConfig) func(ctx context.Context, req if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Apps_list_plansHandler(cfg *config.APIConfig) func(ctx context.Context, req return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Marketplace_listing_plan if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_plans_stubbed.go b/MCP/go/tools/apps/apps_list_plans_stubbed.go index f44bfc4..36a937f 100644 --- a/MCP/go/tools/apps/apps_list_plans_stubbed.go +++ b/MCP/go/tools/apps/apps_list_plans_stubbed.go @@ -26,34 +26,6 @@ func Apps_list_plans_stubbedHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_plans_stubbedHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Apps_list_plans_stubbedHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Marketplace_listing_plan if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_repos_accessible_to_installation.go b/MCP/go/tools/apps/apps_list_repos_accessible_to_installation.go index 55cf011..ee34791 100644 --- a/MCP/go/tools/apps/apps_list_repos_accessible_to_installation.go +++ b/MCP/go/tools/apps/apps_list_repos_accessible_to_installation.go @@ -26,34 +26,6 @@ func Apps_list_repos_accessible_to_installationHandler(cfg *config.APIConfig) fu if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_repos_accessible_to_installationHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user.go b/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user.go index 4b48fd5..34337e1 100644 --- a/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user.go +++ b/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user.go @@ -26,34 +26,6 @@ func Apps_list_subscriptions_for_authenticated_userHandler(cfg *config.APIConfig if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_subscriptions_for_authenticated_userHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Apps_list_subscriptions_for_authenticated_userHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_User_marketplace_purchase if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user_stubbed.go b/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user_stubbed.go index 98d4327..1637af9 100644 --- a/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user_stubbed.go +++ b/MCP/go/tools/apps/apps_list_subscriptions_for_authenticated_user_stubbed.go @@ -26,34 +26,6 @@ func Apps_list_subscriptions_for_authenticated_user_stubbedHandler(cfg *config.A if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_subscriptions_for_authenticated_user_stubbedHandler(cfg *config.A if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Apps_list_subscriptions_for_authenticated_user_stubbedHandler(cfg *config.A return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_User_marketplace_purchase if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_list_webhook_deliveries.go b/MCP/go/tools/apps/apps_list_webhook_deliveries.go index ac6f6af..9f04417 100644 --- a/MCP/go/tools/apps/apps_list_webhook_deliveries.go +++ b/MCP/go/tools/apps/apps_list_webhook_deliveries.go @@ -26,34 +26,6 @@ func Apps_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["cursor"]; ok { queryParams = append(queryParams, fmt.Sprintf("cursor=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Apps_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Apps_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Hook_delivery_item if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/apps/apps_redeliver_webhook_delivery.go b/MCP/go/tools/apps/apps_redeliver_webhook_delivery.go index 05b56f5..5bac18b 100644 --- a/MCP/go/tools/apps/apps_redeliver_webhook_delivery.go +++ b/MCP/go/tools/apps/apps_redeliver_webhook_delivery.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_redeliver_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: delivery_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/hook/deliveries/%s/attempts%s", cfg.BaseURL, delivery_id, queryString) + url := fmt.Sprintf("%s/app/hook/deliveries/%s/attempts", cfg.BaseURL, delivery_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_remove_repo_from_installation_for_authenticated_user.go b/MCP/go/tools/apps/apps_remove_repo_from_installation_for_authenticated_user.go index 86546e2..39e5f98 100644 --- a/MCP/go/tools/apps/apps_remove_repo_from_installation_for_authenticated_user.go +++ b/MCP/go/tools/apps/apps_remove_repo_from_installation_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Apps_remove_repo_from_installation_for_authenticated_userHandler(cfg *confi if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/installations/%s/repositories/%s%s", cfg.BaseURL, installation_id, repository_id, queryString) + url := fmt.Sprintf("%s/user/installations/%s/repositories/%s", cfg.BaseURL, installation_id, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Apps_remove_repo_from_installation_for_authenticated_userHandler(cfg *confi } func CreateApps_remove_repo_from_installation_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_user_installations_installation_id_repositories_repository_id", + tool := mcp.NewTool("delete_user_installations_installation_id_repositories", mcp.WithDescription("Remove a repository from an app installation"), mcp.WithNumber("installation_id", mcp.Required(), mcp.Description("The unique identifier of the installation.")), mcp.WithNumber("repository_id", mcp.Required(), mcp.Description("The unique identifier of the repository.")), diff --git a/MCP/go/tools/apps/apps_reset_token.go b/MCP/go/tools/apps/apps_reset_token.go index 0d5f806..d8043a0 100644 --- a/MCP/go/tools/apps/apps_reset_token.go +++ b/MCP/go/tools/apps/apps_reset_token.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Apps_reset_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: client_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Apps_reset_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/applications/%s/token%s", cfg.BaseURL, client_id, queryString) + url := fmt.Sprintf("%s/applications/%s/token", cfg.BaseURL, client_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_revoke_installation_access_token.go b/MCP/go/tools/apps/apps_revoke_installation_access_token.go index fee7ec2..93bca90 100644 --- a/MCP/go/tools/apps/apps_revoke_installation_access_token.go +++ b/MCP/go/tools/apps/apps_revoke_installation_access_token.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Apps_revoke_installation_access_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/installation/token%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/installation/token", cfg.BaseURL) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_scope_token.go b/MCP/go/tools/apps/apps_scope_token.go index 25aecd1..7db916f 100644 --- a/MCP/go/tools/apps/apps_scope_token.go +++ b/MCP/go/tools/apps/apps_scope_token.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Apps_scope_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: client_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Apps_scope_tokenHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/applications/%s/token/scoped%s", cfg.BaseURL, client_id, queryString) + url := fmt.Sprintf("%s/applications/%s/token/scoped", cfg.BaseURL, client_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -130,12 +99,12 @@ func CreateApps_scope_tokenTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_applications_client_id_token_scoped", mcp.WithDescription("Create a scoped access token"), mcp.WithString("client_id", mcp.Required(), mcp.Description("The client ID of the GitHub app.")), - mcp.WithString("target", mcp.Description("Input parameter: The name of the user or organization to scope the user access token to. **Required** unless `target_id` is specified.")), - mcp.WithNumber("target_id", mcp.Description("Input parameter: The ID of the user or organization to scope the user access token to. **Required** unless `target` is specified.")), mcp.WithString("access_token", mcp.Required(), mcp.Description("Input parameter: The access token used to authenticate to the GitHub API.")), mcp.WithObject("permissions", mcp.Description("Input parameter: The permissions granted to the user access token.")), mcp.WithArray("repositories", mcp.Description("Input parameter: The list of repository names to scope the user access token to. `repositories` may not be specified if `repository_ids` is specified.")), mcp.WithArray("repository_ids", mcp.Description("Input parameter: The list of repository IDs to scope the user access token to. `repository_ids` may not be specified if `repositories` is specified.")), + mcp.WithString("target", mcp.Description("Input parameter: The name of the user or organization to scope the user access token to. **Required** unless `target_id` is specified.")), + mcp.WithNumber("target_id", mcp.Description("Input parameter: The ID of the user or organization to scope the user access token to. **Required** unless `target` is specified.")), ) return models.Tool{ diff --git a/MCP/go/tools/apps/apps_suspend_installation.go b/MCP/go/tools/apps/apps_suspend_installation.go index dd3350a..a273344 100644 --- a/MCP/go/tools/apps/apps_suspend_installation.go +++ b/MCP/go/tools/apps/apps_suspend_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_suspend_installationHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: installation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/installations/%s/suspended%s", cfg.BaseURL, installation_id, queryString) + url := fmt.Sprintf("%s/app/installations/%s/suspended", cfg.BaseURL, installation_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_unsuspend_installation.go b/MCP/go/tools/apps/apps_unsuspend_installation.go index 3e585ca..a6aa7f2 100644 --- a/MCP/go/tools/apps/apps_unsuspend_installation.go +++ b/MCP/go/tools/apps/apps_unsuspend_installation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Apps_unsuspend_installationHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: installation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/app/installations/%s/suspended%s", cfg.BaseURL, installation_id, queryString) + url := fmt.Sprintf("%s/app/installations/%s/suspended", cfg.BaseURL, installation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/apps/apps_update_webhook_config_for_app.go b/MCP/go/tools/apps/apps_update_webhook_config_for_app.go index 79bd91f..10df05e 100644 --- a/MCP/go/tools/apps/apps_update_webhook_config_for_app.go +++ b/MCP/go/tools/apps/apps_update_webhook_config_for_app.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Apps_update_webhook_config_for_appHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Apps_update_webhook_config_for_appHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/app/hook/config%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/app/hook/config", cfg.BaseURL) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Apps_update_webhook_config_for_appHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Webhook_config if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -121,10 +90,10 @@ func Apps_update_webhook_config_for_appHandler(cfg *config.APIConfig) func(ctx c func CreateApps_update_webhook_config_for_appTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("patch_app_hook_config", mcp.WithDescription("Update a webhook configuration for an app"), + mcp.WithString("insecure_ssl", mcp.Description("")), mcp.WithString("secret", mcp.Description("Input parameter: If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers).")), mcp.WithString("url", mcp.Description("Input parameter: The URL to which the payloads will be delivered.")), mcp.WithString("content_type", mcp.Description("Input parameter: The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.")), - mcp.WithString("insecure_ssl", mcp.Description("")), ) return models.Tool{ diff --git a/MCP/go/tools/billing/billing_get_github_actions_billing_org.go b/MCP/go/tools/billing/billing_get_github_actions_billing_org.go index e62b1f3..9ce0a53 100644 --- a/MCP/go/tools/billing/billing_get_github_actions_billing_org.go +++ b/MCP/go/tools/billing/billing_get_github_actions_billing_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Billing_get_github_actions_billing_orgHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/settings/billing/actions%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/billing/actions", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Billing_get_github_actions_billing_orgHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_billing_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_github_actions_billing_user.go b/MCP/go/tools/billing/billing_get_github_actions_billing_user.go index ac96413..04eda53 100644 --- a/MCP/go/tools/billing/billing_get_github_actions_billing_user.go +++ b/MCP/go/tools/billing/billing_get_github_actions_billing_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Billing_get_github_actions_billing_userHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/settings/billing/actions%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s/settings/billing/actions", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Billing_get_github_actions_billing_userHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Actions_billing_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_github_billing_usage_report_org.go b/MCP/go/tools/billing/billing_get_github_billing_usage_report_org.go index b7656ef..1120c52 100644 --- a/MCP/go/tools/billing/billing_get_github_billing_usage_report_org.go +++ b/MCP/go/tools/billing/billing_get_github_billing_usage_report_org.go @@ -40,34 +40,6 @@ func Billing_get_github_billing_usage_report_orgHandler(cfg *config.APIConfig) f if val, ok := args["hour"]; ok { queryParams = append(queryParams, fmt.Sprintf("hour=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Billing_get_github_billing_usage_report_orgHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Billing_get_github_billing_usage_report_orgHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Billing_usage_report if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_github_billing_usage_report_user.go b/MCP/go/tools/billing/billing_get_github_billing_usage_report_user.go index 3ad751d..baf1259 100644 --- a/MCP/go/tools/billing/billing_get_github_billing_usage_report_user.go +++ b/MCP/go/tools/billing/billing_get_github_billing_usage_report_user.go @@ -40,34 +40,6 @@ func Billing_get_github_billing_usage_report_userHandler(cfg *config.APIConfig) if val, ok := args["hour"]; ok { queryParams = append(queryParams, fmt.Sprintf("hour=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Billing_get_github_billing_usage_report_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Billing_get_github_billing_usage_report_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Billing_usage_report_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_github_packages_billing_org.go b/MCP/go/tools/billing/billing_get_github_packages_billing_org.go index 0c476d6..84aa17e 100644 --- a/MCP/go/tools/billing/billing_get_github_packages_billing_org.go +++ b/MCP/go/tools/billing/billing_get_github_packages_billing_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Billing_get_github_packages_billing_orgHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/settings/billing/packages%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/billing/packages", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Billing_get_github_packages_billing_orgHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Packages_billing_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_github_packages_billing_user.go b/MCP/go/tools/billing/billing_get_github_packages_billing_user.go index 9f94893..1093b44 100644 --- a/MCP/go/tools/billing/billing_get_github_packages_billing_user.go +++ b/MCP/go/tools/billing/billing_get_github_packages_billing_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Billing_get_github_packages_billing_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/settings/billing/packages%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s/settings/billing/packages", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Billing_get_github_packages_billing_userHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Packages_billing_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_shared_storage_billing_org.go b/MCP/go/tools/billing/billing_get_shared_storage_billing_org.go index 36e29de..c02af04 100644 --- a/MCP/go/tools/billing/billing_get_shared_storage_billing_org.go +++ b/MCP/go/tools/billing/billing_get_shared_storage_billing_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Billing_get_shared_storage_billing_orgHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/settings/billing/shared-storage%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/billing/shared-storage", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Billing_get_shared_storage_billing_orgHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Combined_billing_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/billing/billing_get_shared_storage_billing_user.go b/MCP/go/tools/billing/billing_get_shared_storage_billing_user.go index 52026c3..3bc66fc 100644 --- a/MCP/go/tools/billing/billing_get_shared_storage_billing_user.go +++ b/MCP/go/tools/billing/billing_get_shared_storage_billing_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Billing_get_shared_storage_billing_userHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/settings/billing/shared-storage%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s/settings/billing/shared-storage", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Billing_get_shared_storage_billing_userHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Combined_billing_usage if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/campaigns/campaigns_create_campaign.go b/MCP/go/tools/campaigns/campaigns_create_campaign.go index 866e432..693c099 100644 --- a/MCP/go/tools/campaigns/campaigns_create_campaign.go +++ b/MCP/go/tools/campaigns/campaigns_create_campaign.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Campaigns_create_campaignHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Campaigns_create_campaignHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/campaigns%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/campaigns", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Campaigns_create_campaignHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Campaign_summary if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,14 +99,14 @@ func CreateCampaigns_create_campaignTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_orgs_org_campaigns", mcp.WithDescription("Create a campaign for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithBoolean("generate_issues", mcp.Description("Input parameter: If true, will automatically generate issues for the campaign. The default is false.")), - mcp.WithArray("managers", mcp.Description("Input parameter: The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied.")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the campaign")), mcp.WithArray("team_managers", mcp.Description("Input parameter: The slugs of the teams to set as the campaign managers.")), mcp.WithArray("code_scanning_alerts", mcp.Required(), mcp.Description("Input parameter: The code scanning alerts to include in this campaign")), mcp.WithString("contact_link", mcp.Description("Input parameter: The contact link of the campaign. Must be a URI.")), mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A description for the campaign")), mcp.WithString("ends_at", mcp.Required(), mcp.Description("Input parameter: The end date and time of the campaign. The date must be in the future.")), + mcp.WithBoolean("generate_issues", mcp.Description("Input parameter: If true, will automatically generate issues for the campaign. The default is false.")), + mcp.WithArray("managers", mcp.Description("Input parameter: The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied.")), ) return models.Tool{ diff --git a/MCP/go/tools/campaigns/campaigns_delete_campaign.go b/MCP/go/tools/campaigns/campaigns_delete_campaign.go index 71e69fb..b152621 100644 --- a/MCP/go/tools/campaigns/campaigns_delete_campaign.go +++ b/MCP/go/tools/campaigns/campaigns_delete_campaign.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Campaigns_delete_campaignHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: campaign_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/campaigns/%s%s", cfg.BaseURL, org, campaign_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/campaigns/%s", cfg.BaseURL, org, campaign_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/campaigns/campaigns_get_campaign_summary.go b/MCP/go/tools/campaigns/campaigns_get_campaign_summary.go index 743a696..3ca0eb2 100644 --- a/MCP/go/tools/campaigns/campaigns_get_campaign_summary.go +++ b/MCP/go/tools/campaigns/campaigns_get_campaign_summary.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Campaigns_get_campaign_summaryHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: campaign_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/campaigns/%s%s", cfg.BaseURL, org, campaign_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/campaigns/%s", cfg.BaseURL, org, campaign_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Campaigns_get_campaign_summaryHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Campaign_summary if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/campaigns/campaigns_list_org_campaigns.go b/MCP/go/tools/campaigns/campaigns_list_org_campaigns.go index afcaee9..9033dc7 100644 --- a/MCP/go/tools/campaigns/campaigns_list_org_campaigns.go +++ b/MCP/go/tools/campaigns/campaigns_list_org_campaigns.go @@ -43,34 +43,6 @@ func Campaigns_list_org_campaignsHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["sort"]; ok { queryParams = append(queryParams, fmt.Sprintf("sort=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -80,17 +52,20 @@ func Campaigns_list_org_campaignsHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -108,7 +83,7 @@ func Campaigns_list_org_campaignsHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Campaign_summary if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/campaigns/campaigns_update_campaign.go b/MCP/go/tools/campaigns/campaigns_update_campaign.go index 8892c45..0d3cb12 100644 --- a/MCP/go/tools/campaigns/campaigns_update_campaign.go +++ b/MCP/go/tools/campaigns/campaigns_update_campaign.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Campaigns_update_campaignHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: campaign_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Campaigns_update_campaignHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/campaigns/%s%s", cfg.BaseURL, org, campaign_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/campaigns/%s", cfg.BaseURL, org, campaign_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Campaigns_update_campaignHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Campaign_summary if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,13 +108,13 @@ func CreateCampaigns_update_campaignTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update a campaign"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("campaign_number", mcp.Required(), mcp.Description("The campaign number.")), + mcp.WithArray("managers", mcp.Description("Input parameter: The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied.")), mcp.WithString("name", mcp.Description("Input parameter: The name of the campaign")), mcp.WithString("state", mcp.Description("Input parameter: Indicates whether a campaign is open or closed")), mcp.WithArray("team_managers", mcp.Description("Input parameter: The slugs of the teams to set as the campaign managers.")), mcp.WithString("contact_link", mcp.Description("Input parameter: The contact link of the campaign. Must be a URI.")), mcp.WithString("description", mcp.Description("Input parameter: A description for the campaign")), mcp.WithString("ends_at", mcp.Description("Input parameter: The end date and time of the campaign, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.")), - mcp.WithArray("managers", mcp.Description("Input parameter: The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied.")), ) return models.Tool{ diff --git a/MCP/go/tools/checks/checks_create.go b/MCP/go/tools/checks/checks_create.go index 5b91b0f..932d0c0 100644 --- a/MCP/go/tools/checks/checks_create.go +++ b/MCP/go/tools/checks/checks_create.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Checks_createHandler(cfg *config.APIConfig) func(ctx context.Context, reque if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -85,23 +51,26 @@ func Checks_createHandler(cfg *config.APIConfig) func(ctx context.Context, reque if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/check-runs%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-runs", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Checks_createHandler(cfg *config.APIConfig) func(ctx context.Context, reque return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_run if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,16 +108,16 @@ func CreateChecks_createTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a check run"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithArray("actions", mcp.Description("Input parameter: Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [`check_run.requested_action` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. To learn more about check runs and requested actions, see \"[Check runs and requested actions](https://docs.github.com/rest/guides/using-the-rest-api-to-interact-with-checks#check-runs-and-requested-actions).\"")), mcp.WithString("conclusion", mcp.Description("Input parameter: **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. \n**Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. You cannot change a check run conclusion to `stale`, only GitHub can set this.")), - mcp.WithString("details_url", mcp.Description("Input parameter: The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used.")), mcp.WithString("started_at", mcp.Description("Input parameter: The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), + mcp.WithString("external_id", mcp.Description("Input parameter: A reference for the run on the integrator's system.")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the check. For example, \"code-coverage\".")), + mcp.WithString("status", mcp.Description("Input parameter: The current status of the check run. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.")), + mcp.WithArray("actions", mcp.Description("Input parameter: Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [`check_run.requested_action` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. To learn more about check runs and requested actions, see \"[Check runs and requested actions](https://docs.github.com/rest/guides/using-the-rest-api-to-interact-with-checks#check-runs-and-requested-actions).\"")), mcp.WithString("completed_at", mcp.Description("Input parameter: The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), mcp.WithString("head_sha", mcp.Required(), mcp.Description("Input parameter: The SHA of the commit.")), + mcp.WithString("details_url", mcp.Description("Input parameter: The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used.")), mcp.WithObject("output", mcp.Description("Input parameter: Check runs can accept a variety of data in the `output` object, including a `title` and `summary` and can optionally provide descriptive details about the run.")), - mcp.WithString("status", mcp.Description("Input parameter: The current status of the check run. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.")), - mcp.WithString("external_id", mcp.Description("Input parameter: A reference for the run on the integrator's system.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the check. For example, \"code-coverage\".")), ) return models.Tool{ diff --git a/MCP/go/tools/checks/checks_create_suite.go b/MCP/go/tools/checks/checks_create_suite.go index 7411167..abe5c39 100644 --- a/MCP/go/tools/checks/checks_create_suite.go +++ b/MCP/go/tools/checks/checks_create_suite.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Checks_create_suiteHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Checks_create_suiteHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/check-suites%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-suites", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Checks_create_suiteHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_suite if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_get.go b/MCP/go/tools/checks/checks_get.go index b0eb927..64aad7b 100644 --- a/MCP/go/tools/checks/checks_get.go +++ b/MCP/go/tools/checks/checks_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Checks_getHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: check_run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/check-runs/%s%s", cfg.BaseURL, owner, repo, check_run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-runs/%s", cfg.BaseURL, owner, repo, check_run_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Checks_getHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_run if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_get_suite.go b/MCP/go/tools/checks/checks_get_suite.go index f389580..7e6bc02 100644 --- a/MCP/go/tools/checks/checks_get_suite.go +++ b/MCP/go/tools/checks/checks_get_suite.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Checks_get_suiteHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: check_suite_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/check-suites/%s%s", cfg.BaseURL, owner, repo, check_suite_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-suites/%s", cfg.BaseURL, owner, repo, check_suite_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Checks_get_suiteHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_suite if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_list_annotations.go b/MCP/go/tools/checks/checks_list_annotations.go index 86381f9..35ff72d 100644 --- a/MCP/go/tools/checks/checks_list_annotations.go +++ b/MCP/go/tools/checks/checks_list_annotations.go @@ -50,34 +50,6 @@ func Checks_list_annotationsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Checks_list_annotationsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Checks_list_annotationsHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Check_annotation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_list_for_ref.go b/MCP/go/tools/checks/checks_list_for_ref.go index e429d4e..dd4b51d 100644 --- a/MCP/go/tools/checks/checks_list_for_ref.go +++ b/MCP/go/tools/checks/checks_list_for_ref.go @@ -62,34 +62,6 @@ func Checks_list_for_refHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["app_id"]; ok { queryParams = append(queryParams, fmt.Sprintf("app_id=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -99,17 +71,20 @@ func Checks_list_for_refHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/checks/checks_list_for_suite.go b/MCP/go/tools/checks/checks_list_for_suite.go index 4112a43..df2ecbb 100644 --- a/MCP/go/tools/checks/checks_list_for_suite.go +++ b/MCP/go/tools/checks/checks_list_for_suite.go @@ -59,34 +59,6 @@ func Checks_list_for_suiteHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -96,17 +68,20 @@ func Checks_list_for_suiteHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/checks/checks_list_suites_for_ref.go b/MCP/go/tools/checks/checks_list_suites_for_ref.go index 9f38301..f6b0024 100644 --- a/MCP/go/tools/checks/checks_list_suites_for_ref.go +++ b/MCP/go/tools/checks/checks_list_suites_for_ref.go @@ -56,34 +56,6 @@ func Checks_list_suites_for_refHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -93,17 +65,20 @@ func Checks_list_suites_for_refHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/checks/checks_rerequest_run.go b/MCP/go/tools/checks/checks_rerequest_run.go index 06c122b..78be9f3 100644 --- a/MCP/go/tools/checks/checks_rerequest_run.go +++ b/MCP/go/tools/checks/checks_rerequest_run.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Checks_rerequest_runHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: check_run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/check-runs/%s/rerequest%s", cfg.BaseURL, owner, repo, check_run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-runs/%s/rerequest", cfg.BaseURL, owner, repo, check_run_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Checks_rerequest_runHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_rerequest_suite.go b/MCP/go/tools/checks/checks_rerequest_suite.go index c5b264e..06f1fc1 100644 --- a/MCP/go/tools/checks/checks_rerequest_suite.go +++ b/MCP/go/tools/checks/checks_rerequest_suite.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Checks_rerequest_suiteHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: check_suite_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/check-suites/%s/rerequest%s", cfg.BaseURL, owner, repo, check_suite_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-suites/%s/rerequest", cfg.BaseURL, owner, repo, check_suite_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Checks_rerequest_suiteHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_set_suites_preferences.go b/MCP/go/tools/checks/checks_set_suites_preferences.go index 877d8b7..16c0939 100644 --- a/MCP/go/tools/checks/checks_set_suites_preferences.go +++ b/MCP/go/tools/checks/checks_set_suites_preferences.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Checks_set_suites_preferencesHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Checks_set_suites_preferencesHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/check-suites/preferences%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-suites/preferences", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Checks_set_suites_preferencesHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_suite_preference if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/checks/checks_update.go b/MCP/go/tools/checks/checks_update.go index d0e484a..4a2c8e5 100644 --- a/MCP/go/tools/checks/checks_update.go +++ b/MCP/go/tools/checks/checks_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Checks_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reque if !ok { return mcp.NewToolResultError("Invalid path parameter: check_run_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Checks_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reque if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/check-runs/%s%s", cfg.BaseURL, owner, repo, check_run_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/check-runs/%s", cfg.BaseURL, owner, repo, check_run_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Checks_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reque return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_run if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,15 +117,15 @@ func CreateChecks_updateTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("check_run_id", mcp.Required(), mcp.Description("The unique identifier of the check run.")), - mcp.WithString("completed_at", mcp.Description("Input parameter: The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), - mcp.WithString("conclusion", mcp.Description("Input parameter: **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. \n**Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. You cannot change a check run conclusion to `stale`, only GitHub can set this.")), - mcp.WithString("name", mcp.Description("Input parameter: The name of the check. For example, \"code-coverage\".")), - mcp.WithString("status", mcp.Description("Input parameter: The current status of the check run. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.")), - mcp.WithString("details_url", mcp.Description("Input parameter: The URL of the integrator's site that has the full details of the check.")), mcp.WithString("external_id", mcp.Description("Input parameter: A reference for the run on the integrator's system.")), mcp.WithObject("output", mcp.Description("Input parameter: Check runs can accept a variety of data in the `output` object, including a `title` and `summary` and can optionally provide descriptive details about the run.")), mcp.WithString("started_at", mcp.Description("Input parameter: This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), mcp.WithArray("actions", mcp.Description("Input parameter: Possible further actions the integrator can perform, which a user may trigger. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. To learn more about check runs and requested actions, see \"[Check runs and requested actions](https://docs.github.com/rest/guides/using-the-rest-api-to-interact-with-checks#check-runs-and-requested-actions).\"")), + mcp.WithString("completed_at", mcp.Description("Input parameter: The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), + mcp.WithString("conclusion", mcp.Description("Input parameter: **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. \n**Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. You cannot change a check run conclusion to `stale`, only GitHub can set this.")), + mcp.WithString("details_url", mcp.Description("Input parameter: The URL of the integrator's site that has the full details of the check.")), + mcp.WithString("name", mcp.Description("Input parameter: The name of the check. For example, \"code-coverage\".")), + mcp.WithString("status", mcp.Description("Input parameter: The current status of the check run. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`.")), ) return models.Tool{ diff --git a/MCP/go/tools/classroom/classroom_get_a_classroom.go b/MCP/go/tools/classroom/classroom_get_a_classroom.go index 4bf5474..38c1d83 100644 --- a/MCP/go/tools/classroom/classroom_get_a_classroom.go +++ b/MCP/go/tools/classroom/classroom_get_a_classroom.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Classroom_get_a_classroomHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: classroom_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/classrooms/%s%s", cfg.BaseURL, classroom_id, queryString) + url := fmt.Sprintf("%s/classrooms/%s", cfg.BaseURL, classroom_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/classroom/classroom_get_an_assignment.go b/MCP/go/tools/classroom/classroom_get_an_assignment.go index 8f09385..6268aeb 100644 --- a/MCP/go/tools/classroom/classroom_get_an_assignment.go +++ b/MCP/go/tools/classroom/classroom_get_an_assignment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Classroom_get_an_assignmentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: assignment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/assignments/%s%s", cfg.BaseURL, assignment_id, queryString) + url := fmt.Sprintf("%s/assignments/%s", cfg.BaseURL, assignment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Classroom_get_an_assignmentHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Classroom_assignment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/classroom/classroom_get_assignment_grades.go b/MCP/go/tools/classroom/classroom_get_assignment_grades.go index 46d38e1..0ab8a0f 100644 --- a/MCP/go/tools/classroom/classroom_get_assignment_grades.go +++ b/MCP/go/tools/classroom/classroom_get_assignment_grades.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Classroom_get_assignment_gradesHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: assignment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/assignments/%s/grades%s", cfg.BaseURL, assignment_id, queryString) + url := fmt.Sprintf("%s/assignments/%s/grades", cfg.BaseURL, assignment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Classroom_get_assignment_gradesHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Classroom_assignment_grade if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/classroom/classroom_list_accepted_assignments_for_an_assignment.go b/MCP/go/tools/classroom/classroom_list_accepted_assignments_for_an_assignment.go index 4a7a014..8a0afa0 100644 --- a/MCP/go/tools/classroom/classroom_list_accepted_assignments_for_an_assignment.go +++ b/MCP/go/tools/classroom/classroom_list_accepted_assignments_for_an_assignment.go @@ -34,34 +34,6 @@ func Classroom_list_accepted_assignments_for_an_assignmentHandler(cfg *config.AP if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Classroom_list_accepted_assignments_for_an_assignmentHandler(cfg *config.AP if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Classroom_list_accepted_assignments_for_an_assignmentHandler(cfg *config.AP return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Classroom_accepted_assignment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -115,7 +90,7 @@ func Classroom_list_accepted_assignments_for_an_assignmentHandler(cfg *config.AP } func CreateClassroom_list_accepted_assignments_for_an_assignmentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_assignments_assignment_id_accepted_assignments", + tool := mcp.NewTool("get_assignments_assignment_id_accepted", mcp.WithDescription("List accepted assignments for an assignment"), mcp.WithNumber("assignment_id", mcp.Required(), mcp.Description("The unique identifier of the classroom assignment.")), mcp.WithNumber("page", mcp.Description("The page number of the results to fetch. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"")), diff --git a/MCP/go/tools/classroom/classroom_list_assignments_for_a_classroom.go b/MCP/go/tools/classroom/classroom_list_assignments_for_a_classroom.go index 4787fa7..35d53a4 100644 --- a/MCP/go/tools/classroom/classroom_list_assignments_for_a_classroom.go +++ b/MCP/go/tools/classroom/classroom_list_assignments_for_a_classroom.go @@ -34,34 +34,6 @@ func Classroom_list_assignments_for_a_classroomHandler(cfg *config.APIConfig) fu if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Classroom_list_assignments_for_a_classroomHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Classroom_list_assignments_for_a_classroomHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_classroom_assignment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/classroom/classroom_list_classrooms.go b/MCP/go/tools/classroom/classroom_list_classrooms.go index 6168c96..0ec47c5 100644 --- a/MCP/go/tools/classroom/classroom_list_classrooms.go +++ b/MCP/go/tools/classroom/classroom_list_classrooms.go @@ -26,34 +26,6 @@ func Classroom_list_classroomsHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Classroom_list_classroomsHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Classroom_list_classroomsHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_classroom if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_commit_autofix.go b/MCP/go/tools/code_scanning/code_scanning_commit_autofix.go index 91872b5..fd19712 100644 --- a/MCP/go/tools/code_scanning/code_scanning_commit_autofix.go +++ b/MCP/go/tools/code_scanning/code_scanning_commit_autofix.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,41 +43,8 @@ func Code_scanning_commit_autofixHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Code_scanning_autofix_commits // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -93,23 +59,26 @@ func Code_scanning_commit_autofixHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s/autofix/commits%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s/autofix/commits", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Code_scanning_commit_autofixHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_autofix_commits_response if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Code_scanning_commit_autofixHandler(cfg *config.APIConfig) func(ctx context } func CreateCode_scanning_commit_autofixTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_code-scanning_alerts_alert_number_autofix_commits", + tool := mcp.NewTool("post_repos_owner_repo_code-scanning_alerts_alert_number", mcp.WithDescription("Commit an autofix for a code scanning alert"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_create_autofix.go b/MCP/go/tools/code_scanning/code_scanning_create_autofix.go index 49b1fba..55e6ca5 100644 --- a/MCP/go/tools/code_scanning/code_scanning_create_autofix.go +++ b/MCP/go/tools/code_scanning/code_scanning_create_autofix.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_create_autofixHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s/autofix%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s/autofix", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_create_autofixHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_autofix if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Code_scanning_create_autofixHandler(cfg *config.APIConfig) func(ctx context } func CreateCode_scanning_create_autofixTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_code-scanning_alerts_alert_number_autofix", + tool := mcp.NewTool("post_repos_owner_repo_code-scanning_alerts_alert_number", mcp.WithDescription("Create an autofix for a code scanning alert"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_create_variant_analysis.go b/MCP/go/tools/code_scanning/code_scanning_create_variant_analysis.go index 86502a2..e08d036 100644 --- a/MCP/go/tools/code_scanning/code_scanning_create_variant_analysis.go +++ b/MCP/go/tools/code_scanning/code_scanning_create_variant_analysis.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_scanning_create_variant_analysisHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -85,23 +51,26 @@ func Code_scanning_create_variant_analysisHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/variant-analyses%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/variant-analyses", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Code_scanning_create_variant_analysisHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_variant_analysis if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,11 +108,11 @@ func CreateCode_scanning_create_variant_analysisTool(cfg *config.APIConfig) mode mcp.WithDescription("Create a CodeQL variant analysis"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("query_pack", mcp.Required(), mcp.Description("Input parameter: A Base64-encoded tarball containing a CodeQL query and all its dependencies")), - mcp.WithArray("repositories", mcp.Description("Input parameter: List of repository names (in the form `owner/repo-name`) to run the query against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.")), mcp.WithArray("repository_lists", mcp.Description("Input parameter: List of repository lists to run the query against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.")), mcp.WithArray("repository_owners", mcp.Description("Input parameter: List of organization or user names whose repositories the query should be run against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.")), mcp.WithString("language", mcp.Required(), mcp.Description("Input parameter: The language targeted by the CodeQL query")), + mcp.WithString("query_pack", mcp.Required(), mcp.Description("Input parameter: A Base64-encoded tarball containing a CodeQL query and all its dependencies")), + mcp.WithArray("repositories", mcp.Description("Input parameter: List of repository names (in the form `owner/repo-name`) to run the query against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.")), ) return models.Tool{ diff --git a/MCP/go/tools/code_scanning/code_scanning_delete_analysis.go b/MCP/go/tools/code_scanning/code_scanning_delete_analysis.go index 1137064..67eecff 100644 --- a/MCP/go/tools/code_scanning/code_scanning_delete_analysis.go +++ b/MCP/go/tools/code_scanning/code_scanning_delete_analysis.go @@ -47,34 +47,6 @@ func Code_scanning_delete_analysisHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["confirm_delete"]; ok { queryParams = append(queryParams, fmt.Sprintf("confirm_delete=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Code_scanning_delete_analysisHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Code_scanning_delete_analysisHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_analysis_deletion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_delete_codeql_database.go b/MCP/go/tools/code_scanning/code_scanning_delete_codeql_database.go index 3c0c67d..f41e6da 100644 --- a/MCP/go/tools/code_scanning/code_scanning_delete_codeql_database.go +++ b/MCP/go/tools/code_scanning/code_scanning_delete_codeql_database.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_delete_codeql_databaseHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: language"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/databases/%s%s", cfg.BaseURL, owner, repo, language, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/databases/%s", cfg.BaseURL, owner, repo, language) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Code_scanning_delete_codeql_databaseHandler(cfg *config.APIConfig) func(ctx } func CreateCode_scanning_delete_codeql_databaseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_code-scanning_codeql_databases_language", + tool := mcp.NewTool("delete_repos_owner_repo_code-scanning_codeql_databases", mcp.WithDescription("Delete a CodeQL database"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_get_alert.go b/MCP/go/tools/code_scanning/code_scanning_get_alert.go index 12de532..98bc596 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_alert.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_alert.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_get_alertHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_get_alertHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_get_analysis.go b/MCP/go/tools/code_scanning/code_scanning_get_analysis.go index fe3f52e..029f8d6 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_analysis.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_analysis.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_get_analysisHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: analysis_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/analyses/%s%s", cfg.BaseURL, owner, repo, analysis_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/analyses/%s", cfg.BaseURL, owner, repo, analysis_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_get_analysisHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_analysis if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_get_autofix.go b/MCP/go/tools/code_scanning/code_scanning_get_autofix.go index 22d0660..322eaf4 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_autofix.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_autofix.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_get_autofixHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s/autofix%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s/autofix", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_get_autofixHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_autofix if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Code_scanning_get_autofixHandler(cfg *config.APIConfig) func(ctx context.Co } func CreateCode_scanning_get_autofixTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_code-scanning_alerts_alert_number_autofix", + tool := mcp.NewTool("get_repos_owner_repo_code-scanning_alerts_alert_number", mcp.WithDescription("Get the status of an autofix for a code scanning alert"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_get_codeql_database.go b/MCP/go/tools/code_scanning/code_scanning_get_codeql_database.go index b2ee65a..c86598e 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_codeql_database.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_codeql_database.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_get_codeql_databaseHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: language"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/databases/%s%s", cfg.BaseURL, owner, repo, language, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/databases/%s", cfg.BaseURL, owner, repo, language) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_get_codeql_databaseHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_codeql_database if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_get_default_setup.go b/MCP/go/tools/code_scanning/code_scanning_get_default_setup.go index 4d1295d..f259785 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_default_setup.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_default_setup.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_scanning_get_default_setupHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/default-setup%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/default-setup", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Code_scanning_get_default_setupHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_default_setup if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_get_sarif.go b/MCP/go/tools/code_scanning/code_scanning_get_sarif.go index 0f83dce..ee55dd4 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_sarif.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_sarif.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_get_sarifHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: sarif_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/sarifs/%s%s", cfg.BaseURL, owner, repo, sarif_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/sarifs/%s", cfg.BaseURL, owner, repo, sarif_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_get_sarifHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_sarifs_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis.go b/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis.go index e263db6..1c7aaea 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Code_scanning_get_variant_analysisHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: codeql_variant_analysis_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/variant-analyses/%s%s", cfg.BaseURL, owner, repo, codeql_variant_analysis_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/variant-analyses/%s", cfg.BaseURL, owner, repo, codeql_variant_analysis_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_scanning_get_variant_analysisHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_variant_analysis if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Code_scanning_get_variant_analysisHandler(cfg *config.APIConfig) func(ctx c } func CreateCode_scanning_get_variant_analysisTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_code-scanning_codeql_variant-analyses_codeql_variant_analysis_id", + tool := mcp.NewTool("get_repos_owner_repo_code-scanning_codeql_variant-analyses", mcp.WithDescription("Get the summary of a CodeQL variant analysis"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis_repo_task.go b/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis_repo_task.go index 49dd135..3044f26 100644 --- a/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis_repo_task.go +++ b/MCP/go/tools/code_scanning/code_scanning_get_variant_analysis_repo_task.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -59,55 +58,25 @@ func Code_scanning_get_variant_analysis_repo_taskHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: repo_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/variant-analyses/%s/repos/%s/%s%s", cfg.BaseURL, owner, repo, codeql_variant_analysis_id, repo_owner, repo_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/variant-analyses/%s/repos/%s/%s", cfg.BaseURL, owner, repo, codeql_variant_analysis_id, repo_owner, repo_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Code_scanning_get_variant_analysis_repo_taskHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_variant_analysis_repo_task if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -141,7 +110,7 @@ func Code_scanning_get_variant_analysis_repo_taskHandler(cfg *config.APIConfig) } func CreateCode_scanning_get_variant_analysis_repo_taskTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_code-scanning_codeql_variant-analyses_codeql_variant_analysis_id_repos_repo_owner_repo_name", + tool := mcp.NewTool("get_repos_owner_repo_code-scanning_codeql_variant-analyses", mcp.WithDescription("Get the analysis status of a repository in a CodeQL variant analysis"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the controller repository.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_list_alert_instances.go b/MCP/go/tools/code_scanning/code_scanning_list_alert_instances.go index cca7002..826961a 100644 --- a/MCP/go/tools/code_scanning/code_scanning_list_alert_instances.go +++ b/MCP/go/tools/code_scanning/code_scanning_list_alert_instances.go @@ -56,34 +56,6 @@ func Code_scanning_list_alert_instancesHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["pr"]; ok { queryParams = append(queryParams, fmt.Sprintf("pr=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -93,17 +65,20 @@ func Code_scanning_list_alert_instancesHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -121,7 +96,7 @@ func Code_scanning_list_alert_instancesHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_scanning_alert_instance if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -137,7 +112,7 @@ func Code_scanning_list_alert_instancesHandler(cfg *config.APIConfig) func(ctx c } func CreateCode_scanning_list_alert_instancesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_code-scanning_alerts_alert_number_instances", + tool := mcp.NewTool("get_repos_owner_repo_code-scanning_alerts_alert_number", mcp.WithDescription("List instances of a code scanning alert"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_org.go b/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_org.go index bcabfe1..a04f629 100644 --- a/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_org.go +++ b/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_org.go @@ -58,34 +58,6 @@ func Code_scanning_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["severity"]; ok { queryParams = append(queryParams, fmt.Sprintf("severity=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -95,17 +67,20 @@ func Code_scanning_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -123,7 +98,7 @@ func Code_scanning_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_scanning_organization_alert_items if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_repo.go b/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_repo.go index 63dc258..cdcd3fa 100644 --- a/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_repo.go +++ b/MCP/go/tools/code_scanning/code_scanning_list_alerts_for_repo.go @@ -72,34 +72,6 @@ func Code_scanning_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["severity"]; ok { queryParams = append(queryParams, fmt.Sprintf("severity=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -109,17 +81,20 @@ func Code_scanning_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -137,7 +112,7 @@ func Code_scanning_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_scanning_alert_items if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_list_codeql_databases.go b/MCP/go/tools/code_scanning/code_scanning_list_codeql_databases.go index 09734d5..beae459 100644 --- a/MCP/go/tools/code_scanning/code_scanning_list_codeql_databases.go +++ b/MCP/go/tools/code_scanning/code_scanning_list_codeql_databases.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_scanning_list_codeql_databasesHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/databases%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/codeql/databases", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Code_scanning_list_codeql_databasesHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_scanning_codeql_database if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_list_recent_analyses.go b/MCP/go/tools/code_scanning/code_scanning_list_recent_analyses.go index 3c1be3d..954af7f 100644 --- a/MCP/go/tools/code_scanning/code_scanning_list_recent_analyses.go +++ b/MCP/go/tools/code_scanning/code_scanning_list_recent_analyses.go @@ -63,34 +63,6 @@ func Code_scanning_list_recent_analysesHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["sort"]; ok { queryParams = append(queryParams, fmt.Sprintf("sort=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -100,17 +72,20 @@ func Code_scanning_list_recent_analysesHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -128,7 +103,7 @@ func Code_scanning_list_recent_analysesHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_scanning_analysis if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_scanning/code_scanning_update_alert.go b/MCP/go/tools/code_scanning/code_scanning_update_alert.go index 9d87b78..81cb59e 100644 --- a/MCP/go/tools/code_scanning/code_scanning_update_alert.go +++ b/MCP/go/tools/code_scanning/code_scanning_update_alert.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Code_scanning_update_alertHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Code_scanning_update_alertHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/alerts/%s", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Code_scanning_update_alertHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,10 +117,10 @@ func CreateCode_scanning_update_alertTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("alert_number", mcp.Required(), mcp.Description("The number that identifies an alert. You can find this at the end of the URL for a code scanning alert within GitHub, and in the `number` field in the response from the `GET /repos/{owner}/{repo}/code-scanning/alerts` operation.")), + mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: Sets the state of the code scanning alert. You must provide `dismissed_reason` when you set the state to `dismissed`.")), mcp.WithBoolean("create_request", mcp.Description("Input parameter: If `true`, attempt to create an alert dismissal request.")), mcp.WithString("dismissed_comment", mcp.Description("Input parameter: The dismissal comment associated with the dismissal of the alert.")), mcp.WithString("dismissed_reason", mcp.Description("Input parameter: **Required when the state is dismissed.** The reason for dismissing or closing the alert.")), - mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: Sets the state of the code scanning alert. You must provide `dismissed_reason` when you set the state to `dismissed`.")), ) return models.Tool{ diff --git a/MCP/go/tools/code_scanning/code_scanning_update_default_setup.go b/MCP/go/tools/code_scanning/code_scanning_update_default_setup.go index 429009c..b7e6ae5 100644 --- a/MCP/go/tools/code_scanning/code_scanning_update_default_setup.go +++ b/MCP/go/tools/code_scanning/code_scanning_update_default_setup.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Code_scanning_update_default_setupHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Code_scanning_default_setup_update // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Code_scanning_update_default_setupHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/default-setup%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/default-setup", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Code_scanning_update_default_setupHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,12 +108,12 @@ func CreateCode_scanning_update_default_setupTool(cfg *config.APIConfig) models. mcp.WithDescription("Update a code scanning default setup configuration"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("state", mcp.Description("Input parameter: The desired state of code scanning default setup.")), mcp.WithString("threat_model", mcp.Description("Input parameter: Threat model to be used for code scanning analysis. Use `remote` to analyze only network sources and `remote_and_local` to include local sources like filesystem access, command-line arguments, database reads, environment variable and standard input.")), mcp.WithArray("languages", mcp.Description("Input parameter: CodeQL languages to be analyzed.")), mcp.WithString("query_suite", mcp.Description("Input parameter: CodeQL query suite to be used.")), mcp.WithString("runner_label", mcp.Description("Input parameter: Runner label to be used if the runner type is labeled.")), mcp.WithString("runner_type", mcp.Description("Input parameter: Runner type to be used.")), + mcp.WithString("state", mcp.Description("Input parameter: The desired state of code scanning default setup.")), ) return models.Tool{ diff --git a/MCP/go/tools/code_scanning/code_scanning_upload_sarif.go b/MCP/go/tools/code_scanning/code_scanning_upload_sarif.go index 2f64c03..e575c93 100644 --- a/MCP/go/tools/code_scanning/code_scanning_upload_sarif.go +++ b/MCP/go/tools/code_scanning/code_scanning_upload_sarif.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_scanning_upload_sarifHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_scanning_upload_sarifHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/sarifs%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-scanning/sarifs", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/code_security/code_security_attach_configuration.go b/MCP/go/tools/code_security/code_security_attach_configuration.go index 3ca01ad..fc345ca 100644 --- a/MCP/go/tools/code_security/code_security_attach_configuration.go +++ b/MCP/go/tools/code_security/code_security_attach_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_security_attach_configurationHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_security_attach_configurationHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s/attach%s", cfg.BaseURL, org, configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s/attach", cfg.BaseURL, org, configuration_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Code_security_attach_configurationHandler(cfg *config.APIConfig) func(ctx c } func CreateCode_security_attach_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_code-security_configurations_configuration_id_attach", + tool := mcp.NewTool("post_orgs_org_code-security_configurations_configuration_id", mcp.WithDescription("Attach a configuration to repositories"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_attach_enterprise_configuration.go b/MCP/go/tools/code_security/code_security_attach_enterprise_configuration.go index 19b74a5..43efd85 100644 --- a/MCP/go/tools/code_security/code_security_attach_enterprise_configuration.go +++ b/MCP/go/tools/code_security/code_security_attach_enterprise_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_security_attach_enterprise_configurationHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_security_attach_enterprise_configurationHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s/attach%s", cfg.BaseURL, enterprise, configuration_id, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s/attach", cfg.BaseURL, enterprise, configuration_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Code_security_attach_enterprise_configurationHandler(cfg *config.APIConfig) } func CreateCode_security_attach_enterprise_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_enterprises_enterprise_code-security_configurations_configuration_id_attach", + tool := mcp.NewTool("post_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Attach an enterprise configuration to repositories"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_create_configuration.go b/MCP/go/tools/code_security/code_security_create_configuration.go index 8386676..bc2e128 100644 --- a/MCP/go/tools/code_security/code_security_create_configuration.go +++ b/MCP/go/tools/code_security/code_security_create_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Code_security_create_configurationHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Code_security_create_configurationHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Code_security_create_configurationHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,27 +99,27 @@ func CreateCode_security_create_configurationTool(cfg *config.APIConfig) models. tool := mcp.NewTool("post_orgs_org_code-security_configurations", mcp.WithDescription("Create a code security configuration"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("secret_scanning_delegated_bypass", mcp.Description("Input parameter: The enablement status of secret scanning delegated bypass")), + mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), + mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), mcp.WithString("secret_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of secret scanning delegated alert dismissal")), - mcp.WithString("code_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of code scanning delegated alert dismissal")), - mcp.WithString("private_vulnerability_reporting", mcp.Description("Input parameter: The enablement status of private vulnerability reporting")), - mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), mcp.WithObject("secret_scanning_delegated_bypass_options", mcp.Description("Input parameter: Feature options for secret scanning delegated bypass")), - mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), - mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement status for a security configuration")), - mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), - mcp.WithString("dependabot_security_updates", mcp.Description("Input parameter: The enablement status of Dependabot security updates")), + mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), + mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), + mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A description of the code security configuration")), - mcp.WithObject("dependency_graph_autosubmit_action_options", mcp.Description("Input parameter: Feature options for Automatic dependency submission")), + mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), - mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), - mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), - mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), + mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement status for a security configuration")), + mcp.WithString("code_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of code scanning delegated alert dismissal")), + mcp.WithString("secret_scanning_delegated_bypass", mcp.Description("Input parameter: The enablement status of secret scanning delegated bypass")), mcp.WithString("secret_scanning_non_provider_patterns", mcp.Description("Input parameter: The enablement status of secret scanning non provider patterns")), - mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), - mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), - mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), + mcp.WithObject("dependency_graph_autosubmit_action_options", mcp.Description("Input parameter: Feature options for Automatic dependency submission")), + mcp.WithString("private_vulnerability_reporting", mcp.Description("Input parameter: The enablement status of private vulnerability reporting")), + mcp.WithString("dependabot_security_updates", mcp.Description("Input parameter: The enablement status of Dependabot security updates")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the code security configuration. Must be unique within the organization.")), + mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), + mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), + mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), ) return models.Tool{ diff --git a/MCP/go/tools/code_security/code_security_create_configuration_for_enterprise.go b/MCP/go/tools/code_security/code_security_create_configuration_for_enterprise.go index 96ae890..dccaac9 100644 --- a/MCP/go/tools/code_security/code_security_create_configuration_for_enterprise.go +++ b/MCP/go/tools/code_security/code_security_create_configuration_for_enterprise.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Code_security_create_configuration_for_enterpriseHandler(cfg *config.APICon if !ok { return mcp.NewToolResultError("Invalid path parameter: enterprise"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Code_security_create_configuration_for_enterpriseHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations%s", cfg.BaseURL, enterprise, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations", cfg.BaseURL, enterprise) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Code_security_create_configuration_for_enterpriseHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,25 +99,25 @@ func CreateCode_security_create_configuration_for_enterpriseTool(cfg *config.API tool := mcp.NewTool("post_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Create a code security configuration for an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), - mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), + mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), + mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A description of the code security configuration")), + mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), + mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), + mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), + mcp.WithString("secret_scanning_non_provider_patterns", mcp.Description("Input parameter: The enablement status of secret scanning non provider patterns")), + mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), mcp.WithString("dependabot_security_updates", mcp.Description("Input parameter: The enablement status of Dependabot security updates")), + mcp.WithObject("dependency_graph_autosubmit_action_options", mcp.Description("Input parameter: Feature options for Automatic dependency submission")), mcp.WithString("code_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of code scanning delegated alert dismissal")), - mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), - mcp.WithString("secret_scanning_non_provider_patterns", mcp.Description("Input parameter: The enablement status of secret scanning non provider patterns")), + mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement status for a security configuration")), mcp.WithString("private_vulnerability_reporting", mcp.Description("Input parameter: The enablement status of private vulnerability reporting")), mcp.WithString("secret_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of secret scanning delegated alert dismissal")), - mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), - mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), - mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), - mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), - mcp.WithObject("dependency_graph_autosubmit_action_options", mcp.Description("Input parameter: Feature options for Automatic dependency submission")), - mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), - mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), - mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), - mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A description of the code security configuration")), + mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), + mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the code security configuration. Must be unique within the enterprise.")), + mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), ) return models.Tool{ diff --git a/MCP/go/tools/code_security/code_security_delete_configuration.go b/MCP/go/tools/code_security/code_security_delete_configuration.go index 316648b..bf6bbbd 100644 --- a/MCP/go/tools/code_security/code_security_delete_configuration.go +++ b/MCP/go/tools/code_security/code_security_delete_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_security_delete_configurationHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s%s", cfg.BaseURL, org, configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s", cfg.BaseURL, org, configuration_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Code_security_delete_configurationHandler(cfg *config.APIConfig) func(ctx c } func CreateCode_security_delete_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_code-security_configurations_configuration_id", + tool := mcp.NewTool("delete_orgs_org_code-security_configurations_configuration", mcp.WithDescription("Delete a code security configuration"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_delete_configuration_for_enterprise.go b/MCP/go/tools/code_security/code_security_delete_configuration_for_enterprise.go index 407419a..347a290 100644 --- a/MCP/go/tools/code_security/code_security_delete_configuration_for_enterprise.go +++ b/MCP/go/tools/code_security/code_security_delete_configuration_for_enterprise.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_security_delete_configuration_for_enterpriseHandler(cfg *config.APICon if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s%s", cfg.BaseURL, enterprise, configuration_id, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s", cfg.BaseURL, enterprise, configuration_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Code_security_delete_configuration_for_enterpriseHandler(cfg *config.APICon } func CreateCode_security_delete_configuration_for_enterpriseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_enterprises_enterprise_code-security_configurations_configuration_id", + tool := mcp.NewTool("delete_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Delete a code security configuration for an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_detach_configuration.go b/MCP/go/tools/code_security/code_security_detach_configuration.go index a29e5ae..0377f71 100644 --- a/MCP/go/tools/code_security/code_security_detach_configuration.go +++ b/MCP/go/tools/code_security/code_security_detach_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Code_security_detach_configurationHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Code_security_detach_configurationHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/detach%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/detach", cfg.BaseURL, org) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/code_security/code_security_get_configuration.go b/MCP/go/tools/code_security/code_security_get_configuration.go index 66979e2..90da7dc 100644 --- a/MCP/go/tools/code_security/code_security_get_configuration.go +++ b/MCP/go/tools/code_security/code_security_get_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_security_get_configurationHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s%s", cfg.BaseURL, org, configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s", cfg.BaseURL, org, configuration_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Code_security_get_configurationHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Code_security_get_configurationHandler(cfg *config.APIConfig) func(ctx cont } func CreateCode_security_get_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_code-security_configurations_configuration_id", + tool := mcp.NewTool("get_orgs_org_code-security_configurations_configuration_id_2", mcp.WithDescription("Get a code security configuration"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_get_configuration_for_repository.go b/MCP/go/tools/code_security/code_security_get_configuration_for_repository.go index a31831b..ce6f497 100644 --- a/MCP/go/tools/code_security/code_security_get_configuration_for_repository.go +++ b/MCP/go/tools/code_security/code_security_get_configuration_for_repository.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_security_get_configuration_for_repositoryHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/code-security-configuration%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/code-security-configuration", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Code_security_get_configuration_for_repositoryHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration_for_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_security/code_security_get_configurations_for_enterprise.go b/MCP/go/tools/code_security/code_security_get_configurations_for_enterprise.go index 68baa38..6e8ecb0 100644 --- a/MCP/go/tools/code_security/code_security_get_configurations_for_enterprise.go +++ b/MCP/go/tools/code_security/code_security_get_configurations_for_enterprise.go @@ -37,34 +37,6 @@ func Code_security_get_configurations_for_enterpriseHandler(cfg *config.APIConfi if val, ok := args["after"]; ok { queryParams = append(queryParams, fmt.Sprintf("after=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Code_security_get_configurations_for_enterpriseHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Code_security_get_configurations_for_enterpriseHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -118,7 +93,7 @@ func Code_security_get_configurations_for_enterpriseHandler(cfg *config.APIConfi } func CreateCode_security_get_configurations_for_enterpriseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations", + tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations_2", mcp.WithDescription("Get code security configurations for an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("per_page", mcp.Description("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"")), diff --git a/MCP/go/tools/code_security/code_security_get_configurations_for_org.go b/MCP/go/tools/code_security/code_security_get_configurations_for_org.go index 47a1285..94153c6 100644 --- a/MCP/go/tools/code_security/code_security_get_configurations_for_org.go +++ b/MCP/go/tools/code_security/code_security_get_configurations_for_org.go @@ -40,34 +40,6 @@ func Code_security_get_configurations_for_orgHandler(cfg *config.APIConfig) func if val, ok := args["after"]; ok { queryParams = append(queryParams, fmt.Sprintf("after=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Code_security_get_configurations_for_orgHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Code_security_get_configurations_for_orgHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/code_security/code_security_get_default_configurations.go b/MCP/go/tools/code_security/code_security_get_default_configurations.go index 8322955..a17fc39 100644 --- a/MCP/go/tools/code_security/code_security_get_default_configurations.go +++ b/MCP/go/tools/code_security/code_security_get_default_configurations.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Code_security_get_default_configurationsHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/defaults%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/defaults", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/code_security/code_security_get_default_configurations_for_enterprise.go b/MCP/go/tools/code_security/code_security_get_default_configurations_for_enterprise.go index f3dbe36..86d6b30 100644 --- a/MCP/go/tools/code_security/code_security_get_default_configurations_for_enterprise.go +++ b/MCP/go/tools/code_security/code_security_get_default_configurations_for_enterprise.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Code_security_get_default_configurations_for_enterpriseHandler(cfg *config. if !ok { return mcp.NewToolResultError("Invalid path parameter: enterprise"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/defaults%s", cfg.BaseURL, enterprise, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/defaults", cfg.BaseURL, enterprise) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Code_security_get_default_configurations_for_enterpriseHandler(cfg *config. } func CreateCode_security_get_default_configurations_for_enterpriseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations_defaults", + tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Get default code security configurations for an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), ) diff --git a/MCP/go/tools/code_security/code_security_get_repositories_for_configuration.go b/MCP/go/tools/code_security/code_security_get_repositories_for_configuration.go index b3ca8e1..d36b531 100644 --- a/MCP/go/tools/code_security/code_security_get_repositories_for_configuration.go +++ b/MCP/go/tools/code_security/code_security_get_repositories_for_configuration.go @@ -48,34 +48,6 @@ func Code_security_get_repositories_for_configurationHandler(cfg *config.APIConf if val, ok := args["status"]; ok { queryParams = append(queryParams, fmt.Sprintf("status=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Code_security_get_repositories_for_configurationHandler(cfg *config.APIConf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -113,7 +88,7 @@ func Code_security_get_repositories_for_configurationHandler(cfg *config.APIConf return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_security_configuration_repositories if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -129,7 +104,7 @@ func Code_security_get_repositories_for_configurationHandler(cfg *config.APIConf } func CreateCode_security_get_repositories_for_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_code-security_configurations_configuration_id_repositories", + tool := mcp.NewTool("get_orgs_org_code-security_configurations_configuration_id", mcp.WithDescription("Get repositories associated with a code security configuration"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_get_repositories_for_enterprise_configuration.go b/MCP/go/tools/code_security/code_security_get_repositories_for_enterprise_configuration.go index 1af4508..fc6774e 100644 --- a/MCP/go/tools/code_security/code_security_get_repositories_for_enterprise_configuration.go +++ b/MCP/go/tools/code_security/code_security_get_repositories_for_enterprise_configuration.go @@ -48,34 +48,6 @@ func Code_security_get_repositories_for_enterprise_configurationHandler(cfg *con if val, ok := args["status"]; ok { queryParams = append(queryParams, fmt.Sprintf("status=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Code_security_get_repositories_for_enterprise_configurationHandler(cfg *con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -113,7 +88,7 @@ func Code_security_get_repositories_for_enterprise_configurationHandler(cfg *con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_security_configuration_repositories if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -129,7 +104,7 @@ func Code_security_get_repositories_for_enterprise_configurationHandler(cfg *con } func CreateCode_security_get_repositories_for_enterprise_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations_configuration_id_repositories", + tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Get repositories associated with an enterprise code security configuration"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_get_single_configuration_for_enterprise.go b/MCP/go/tools/code_security/code_security_get_single_configuration_for_enterprise.go index d930115..fc96b1d 100644 --- a/MCP/go/tools/code_security/code_security_get_single_configuration_for_enterprise.go +++ b/MCP/go/tools/code_security/code_security_get_single_configuration_for_enterprise.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Code_security_get_single_configuration_for_enterpriseHandler(cfg *config.AP if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s%s", cfg.BaseURL, enterprise, configuration_id, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s", cfg.BaseURL, enterprise, configuration_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Code_security_get_single_configuration_for_enterpriseHandler(cfg *config.AP return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Code_security_get_single_configuration_for_enterpriseHandler(cfg *config.AP } func CreateCode_security_get_single_configuration_for_enterpriseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations_configuration_id", + tool := mcp.NewTool("get_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Retrieve a code security configuration of an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_set_configuration_as_default.go b/MCP/go/tools/code_security/code_security_set_configuration_as_default.go index 801a022..5df88d7 100644 --- a/MCP/go/tools/code_security/code_security_set_configuration_as_default.go +++ b/MCP/go/tools/code_security/code_security_set_configuration_as_default.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_security_set_configuration_as_defaultHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_security_set_configuration_as_defaultHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s/defaults%s", cfg.BaseURL, org, configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s/defaults", cfg.BaseURL, org, configuration_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Code_security_set_configuration_as_defaultHandler(cfg *config.APIConfig) fu } func CreateCode_security_set_configuration_as_defaultTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_code-security_configurations_configuration_id_defaults", + tool := mcp.NewTool("put_orgs_org_code-security_configurations_configuration_id", mcp.WithDescription("Set a code security configuration as a default for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_set_configuration_as_default_for_enterprise.go b/MCP/go/tools/code_security/code_security_set_configuration_as_default_for_enterprise.go index 9151b88..f56fa4d 100644 --- a/MCP/go/tools/code_security/code_security_set_configuration_as_default_for_enterprise.go +++ b/MCP/go/tools/code_security/code_security_set_configuration_as_default_for_enterprise.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_security_set_configuration_as_default_for_enterpriseHandler(cfg *confi if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_security_set_configuration_as_default_for_enterpriseHandler(cfg *confi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s/defaults%s", cfg.BaseURL, enterprise, configuration_id, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s/defaults", cfg.BaseURL, enterprise, configuration_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Code_security_set_configuration_as_default_for_enterpriseHandler(cfg *confi } func CreateCode_security_set_configuration_as_default_for_enterpriseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_enterprises_enterprise_code-security_configurations_configuration_id_defaults", + tool := mcp.NewTool("put_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Set a code security configuration as a default for an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), diff --git a/MCP/go/tools/code_security/code_security_update_configuration.go b/MCP/go/tools/code_security/code_security_update_configuration.go index 53ba411..4f315bd 100644 --- a/MCP/go/tools/code_security/code_security_update_configuration.go +++ b/MCP/go/tools/code_security/code_security_update_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_security_update_configurationHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_security_update_configurationHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s%s", cfg.BaseURL, org, configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/code-security/configurations/%s", cfg.BaseURL, org, configuration_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Code_security_update_configurationHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,27 +108,27 @@ func CreateCode_security_update_configurationTool(cfg *config.APIConfig) models. mcp.WithDescription("Update a code security configuration"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), - mcp.WithObject("secret_scanning_delegated_bypass_options", mcp.Description("Input parameter: Feature options for secret scanning delegated bypass")), - mcp.WithString("description", mcp.Description("Input parameter: A description of the code security configuration")), - mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), - mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), + mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement status for a security configuration")), + mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), mcp.WithString("private_vulnerability_reporting", mcp.Description("Input parameter: The enablement status of private vulnerability reporting")), + mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), + mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), + mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), + mcp.WithString("name", mcp.Description("Input parameter: The name of the code security configuration. Must be unique within the organization.")), + mcp.WithString("secret_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of secret scanning delegated alert dismissal")), + mcp.WithString("secret_scanning_delegated_bypass", mcp.Description("Input parameter: The enablement status of secret scanning delegated bypass")), + mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), + mcp.WithString("secret_scanning_non_provider_patterns", mcp.Description("Input parameter: The enablement status of secret scanning non-provider patterns")), mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), - mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), - mcp.WithString("code_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of code scanning delegated alert dismissal")), mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), + mcp.WithString("description", mcp.Description("Input parameter: A description of the code security configuration")), + mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), + mcp.WithString("code_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of code scanning delegated alert dismissal")), mcp.WithString("dependabot_security_updates", mcp.Description("Input parameter: The enablement status of Dependabot security updates")), - mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), - mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), - mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), - mcp.WithString("secret_scanning_non_provider_patterns", mcp.Description("Input parameter: The enablement status of secret scanning non-provider patterns")), mcp.WithObject("dependency_graph_autosubmit_action_options", mcp.Description("Input parameter: Feature options for Automatic dependency submission")), - mcp.WithString("name", mcp.Description("Input parameter: The name of the code security configuration. Must be unique within the organization.")), - mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), - mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement status for a security configuration")), - mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), - mcp.WithString("secret_scanning_delegated_bypass", mcp.Description("Input parameter: The enablement status of secret scanning delegated bypass")), - mcp.WithString("secret_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of secret scanning delegated alert dismissal")), + mcp.WithObject("secret_scanning_delegated_bypass_options", mcp.Description("Input parameter: Feature options for secret scanning delegated bypass")), + mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), + mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), ) return models.Tool{ diff --git a/MCP/go/tools/code_security/code_security_update_enterprise_configuration.go b/MCP/go/tools/code_security/code_security_update_enterprise_configuration.go index e1bf651..06bc006 100644 --- a/MCP/go/tools/code_security/code_security_update_enterprise_configuration.go +++ b/MCP/go/tools/code_security/code_security_update_enterprise_configuration.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Code_security_update_enterprise_configurationHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Code_security_update_enterprise_configurationHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s%s", cfg.BaseURL, enterprise, configuration_id, queryString) + url := fmt.Sprintf("%s/enterprises/%s/code-security/configurations/%s", cfg.BaseURL, enterprise, configuration_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Code_security_update_enterprise_configurationHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_security_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -135,29 +104,29 @@ func Code_security_update_enterprise_configurationHandler(cfg *config.APIConfig) } func CreateCode_security_update_enterprise_configurationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_enterprises_enterprise_code-security_configurations_configuration_id", + tool := mcp.NewTool("patch_enterprises_enterprise_code-security_configurations", mcp.WithDescription("Update a custom code security configuration for an enterprise"), mcp.WithString("enterprise", mcp.Required(), mcp.Description("The slug version of the enterprise name. You can also substitute this value with the enterprise id.")), mcp.WithNumber("configuration_id", mcp.Required(), mcp.Description("The unique identifier of the code security configuration.")), - mcp.WithString("private_vulnerability_reporting", mcp.Description("Input parameter: The enablement status of private vulnerability reporting")), + mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), + mcp.WithString("dependabot_security_updates", mcp.Description("Input parameter: The enablement status of Dependabot security updates")), + mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), + mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), + mcp.WithString("secret_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of secret scanning delegated alert dismissal")), mcp.WithString("secret_scanning_non_provider_patterns", mcp.Description("Input parameter: The enablement status of secret scanning non-provider patterns")), - mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), - mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), + mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement status for a security configuration")), - mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), + mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), + mcp.WithString("private_vulnerability_reporting", mcp.Description("Input parameter: The enablement status of private vulnerability reporting")), mcp.WithString("code_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of code scanning delegated alert dismissal")), + mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), mcp.WithString("name", mcp.Description("Input parameter: The name of the code security configuration. Must be unique across the enterprise.")), - mcp.WithString("dependabot_security_updates", mcp.Description("Input parameter: The enablement status of Dependabot security updates")), - mcp.WithString("secret_scanning_generic_secrets", mcp.Description("Input parameter: The enablement status of Copilot secret scanning")), - mcp.WithString("dependency_graph", mcp.Description("Input parameter: The enablement status of Dependency Graph")), + mcp.WithString("code_scanning_default_setup", mcp.Description("Input parameter: The enablement status of code scanning default setup")), mcp.WithString("secret_scanning_push_protection", mcp.Description("Input parameter: The enablement status of secret scanning push protection")), - mcp.WithString("advanced_security", mcp.Description("Input parameter: The enablement status of GitHub Advanced Security features. `enabled` will enable both Code Security and Secret Protection features.")), - mcp.WithString("secret_scanning", mcp.Description("Input parameter: The enablement status of secret scanning")), + mcp.WithObject("code_scanning_default_setup_options", mcp.Description("Input parameter: Feature options for code scanning default setup")), mcp.WithObject("dependency_graph_autosubmit_action_options", mcp.Description("Input parameter: Feature options for Automatic dependency submission")), - mcp.WithString("secret_scanning_validity_checks", mcp.Description("Input parameter: The enablement status of secret scanning validity checks")), mcp.WithString("description", mcp.Description("Input parameter: A description of the code security configuration")), - mcp.WithString("dependency_graph_autosubmit_action", mcp.Description("Input parameter: The enablement status of Automatic dependency submission")), - mcp.WithString("secret_scanning_delegated_alert_dismissal", mcp.Description("Input parameter: The enablement status of secret scanning delegated alert dismissal")), + mcp.WithString("dependabot_alerts", mcp.Description("Input parameter: The enablement status of Dependabot alerts")), ) return models.Tool{ diff --git a/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_all_codes_of_conduct.go b/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_all_codes_of_conduct.go index c3c16f4..61ce4c3 100644 --- a/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_all_codes_of_conduct.go +++ b/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_all_codes_of_conduct.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Codes_of_conduct_get_all_codes_of_conductHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/codes_of_conduct%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/codes_of_conduct", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -81,7 +50,7 @@ func Codes_of_conduct_get_all_codes_of_conductHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Code_of_conduct if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_conduct_code.go b/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_conduct_code.go index 607157a..cfe7034 100644 --- a/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_conduct_code.go +++ b/MCP/go/tools/codes_of_conduct/codes_of_conduct_get_conduct_code.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codes_of_conduct_get_conduct_codeHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: key"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/codes_of_conduct/%s%s", cfg.BaseURL, key, queryString) + url := fmt.Sprintf("%s/codes_of_conduct/%s", cfg.BaseURL, key) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Codes_of_conduct_get_conduct_codeHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Code_of_conduct if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_add_repository_for_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_add_repository_for_secret_for_authenticated_user.go index 0908463..c0036da 100644 --- a/MCP/go/tools/codespaces/codespaces_add_repository_for_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_add_repository_for_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Codespaces_add_repository_for_secret_for_authenticated_userHandler(cfg *con if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories/%s%s", cfg.BaseURL, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories/%s", cfg.BaseURL, secret_name, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Codespaces_add_repository_for_secret_for_authenticated_userHandler(cfg *con } func CreateCodespaces_add_repository_for_secret_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_user_codespaces_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("put_user_codespaces_secrets_secret_name_repositories", mcp.WithDescription("Add a selected repository to a user secret"), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), mcp.WithNumber("repository_id", mcp.Required(), mcp.Description("")), diff --git a/MCP/go/tools/codespaces/codespaces_add_selected_repo_to_org_secret.go b/MCP/go/tools/codespaces/codespaces_add_selected_repo_to_org_secret.go index bafb7a8..1b48bf8 100644 --- a/MCP/go/tools/codespaces/codespaces_add_selected_repo_to_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_add_selected_repo_to_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Codespaces_add_selected_repo_to_org_secretHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s/repositories/%s%s", cfg.BaseURL, org, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s/repositories/%s", cfg.BaseURL, org, secret_name, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Codespaces_add_selected_repo_to_org_secretHandler(cfg *config.APIConfig) fu } func CreateCodespaces_add_selected_repo_to_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_codespaces_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("put_orgs_org_codespaces_secrets_secret_name_repositories", mcp.WithDescription("Add selected repository to an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/codespaces/codespaces_check_permissions_for_devcontainer.go b/MCP/go/tools/codespaces/codespaces_check_permissions_for_devcontainer.go index 568ea96..73e5de8 100644 --- a/MCP/go/tools/codespaces/codespaces_check_permissions_for_devcontainer.go +++ b/MCP/go/tools/codespaces/codespaces_check_permissions_for_devcontainer.go @@ -42,34 +42,6 @@ func Codespaces_check_permissions_for_devcontainerHandler(cfg *config.APIConfig) if val, ok := args["devcontainer_path"]; ok { queryParams = append(queryParams, fmt.Sprintf("devcontainer_path=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_check_permissions_for_devcontainerHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Codespaces_check_permissions_for_devcontainerHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespaces_permissions_check_for_devcontainer if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_codespace_machines_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_codespace_machines_for_authenticated_user.go index 60db757..763a6d9 100644 --- a/MCP/go/tools/codespaces/codespaces_codespace_machines_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_codespace_machines_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_codespace_machines_for_authenticated_userHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s/machines%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s/machines", cfg.BaseURL, codespace_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_create_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_create_for_authenticated_user.go index 4e4202d..ed81295 100644 --- a/MCP/go/tools/codespaces/codespaces_create_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_create_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Codespaces_create_for_authenticated_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -69,23 +35,26 @@ func Codespaces_create_for_authenticated_userHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/codespaces%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/codespaces", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_create_or_update_org_secret.go b/MCP/go/tools/codespaces/codespaces_create_or_update_org_secret.go index d857b4a..04c9fea 100644 --- a/MCP/go/tools/codespaces/codespaces_create_or_update_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_create_or_update_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Codespaces_create_or_update_org_secretHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Codespaces_create_or_update_org_secretHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Codespaces_create_or_update_org_secretHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,10 +108,10 @@ func CreateCodespaces_create_or_update_org_secretTool(cfg *config.APIConfig) mod mcp.WithDescription("Create or update an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), - mcp.WithString("key_id", mcp.Description("Input parameter: The ID of the key you used to encrypt the secret.")), mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository IDs that can access the organization secret. You can only provide a list of repository IDs when the `visibility` is set to `selected`. You can manage the list of selected repositories using the [List selected repositories for an organization secret](https://docs.github.com/rest/codespaces/organization-secrets#list-selected-repositories-for-an-organization-secret), [Set selected repositories for an organization secret](https://docs.github.com/rest/codespaces/organization-secrets#set-selected-repositories-for-an-organization-secret), and [Remove selected repository from an organization secret](https://docs.github.com/rest/codespaces/organization-secrets#remove-selected-repository-from-an-organization-secret) endpoints.")), mcp.WithString("visibility", mcp.Required(), mcp.Description("Input parameter: Which type of organization repositories have access to the organization secret. `selected` means only the repositories specified by `selected_repository_ids` can access the secret.")), mcp.WithString("encrypted_value", mcp.Description("Input parameter: The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-public-key) endpoint.")), + mcp.WithString("key_id", mcp.Description("Input parameter: The ID of the key you used to encrypt the secret.")), ) return models.Tool{ diff --git a/MCP/go/tools/codespaces/codespaces_create_or_update_repo_secret.go b/MCP/go/tools/codespaces/codespaces_create_or_update_repo_secret.go index 2f17224..b203ef9 100644 --- a/MCP/go/tools/codespaces/codespaces_create_or_update_repo_secret.go +++ b/MCP/go/tools/codespaces/codespaces_create_or_update_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Codespaces_create_or_update_repo_secretHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Codespaces_create_or_update_repo_secretHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Codespaces_create_or_update_repo_secretHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_create_or_update_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_create_or_update_secret_for_authenticated_user.go index ff6ae94..116f7cd 100644 --- a/MCP/go/tools/codespaces/codespaces_create_or_update_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_create_or_update_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_create_or_update_secret_for_authenticated_userHandler(cfg *confi if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_create_or_update_secret_for_authenticated_userHandler(cfg *confi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s%s", cfg.BaseURL, secret_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s", cfg.BaseURL, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Codespaces_create_or_update_secret_for_authenticated_userHandler(cfg *confi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,9 +99,9 @@ func CreateCodespaces_create_or_update_secret_for_authenticated_userTool(cfg *co tool := mcp.NewTool("put_user_codespaces_secrets_secret_name", mcp.WithDescription("Create or update a secret for the authenticated user"), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), + mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository ids that can access the user secret. You can manage the list of selected repositories using the [List selected repositories for a user secret](https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret), [Set selected repositories for a user secret](https://docs.github.com/rest/codespaces/secrets#set-selected-repositories-for-a-user-secret), and [Remove a selected repository from a user secret](https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret) endpoints.")), mcp.WithString("encrypted_value", mcp.Description("Input parameter: Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get the public key for the authenticated user](https://docs.github.com/rest/codespaces/secrets#get-public-key-for-the-authenticated-user) endpoint.")), mcp.WithString("key_id", mcp.Required(), mcp.Description("Input parameter: ID of the key you used to encrypt the secret.")), - mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository ids that can access the user secret. You can manage the list of selected repositories using the [List selected repositories for a user secret](https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret), [Set selected repositories for a user secret](https://docs.github.com/rest/codespaces/secrets#set-selected-repositories-for-a-user-secret), and [Remove a selected repository from a user secret](https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret) endpoints.")), ) return models.Tool{ diff --git a/MCP/go/tools/codespaces/codespaces_create_with_pr_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_create_with_pr_for_authenticated_user.go index 52ea5a4..af70d60 100644 --- a/MCP/go/tools/codespaces/codespaces_create_with_pr_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_create_with_pr_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Codespaces_create_with_pr_for_authenticated_userHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Codespaces_create_with_pr_for_authenticated_userHandler(cfg *config.APIConf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/codespaces%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/codespaces", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -148,16 +117,16 @@ func CreateCodespaces_create_with_pr_for_authenticated_userTool(cfg *config.APIC mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("pull_number", mcp.Required(), mcp.Description("The number that identifies the pull request.")), + mcp.WithNumber("idle_timeout_minutes", mcp.Description("Input parameter: Time in minutes before codespace stops from inactivity")), + mcp.WithString("machine", mcp.Description("Input parameter: Machine type to use for this codespace")), + mcp.WithString("devcontainer_path", mcp.Description("Input parameter: Path to devcontainer.json config to use for this codespace")), mcp.WithBoolean("multi_repo_permissions_opt_out", mcp.Description("Input parameter: Whether to authorize requested permissions from devcontainer.json")), mcp.WithString("location", mcp.Description("Input parameter: The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided.")), mcp.WithNumber("retention_period_minutes", mcp.Description("Input parameter: Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).")), - mcp.WithString("client_ip", mcp.Description("Input parameter: IP for location auto-detection when proxying a request")), - mcp.WithString("devcontainer_path", mcp.Description("Input parameter: Path to devcontainer.json config to use for this codespace")), - mcp.WithString("geo", mcp.Description("Input parameter: The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces `location`, which is closing down.")), - mcp.WithNumber("idle_timeout_minutes", mcp.Description("Input parameter: Time in minutes before codespace stops from inactivity")), mcp.WithString("working_directory", mcp.Description("Input parameter: Working directory for this codespace")), mcp.WithString("display_name", mcp.Description("Input parameter: Display name for this codespace")), - mcp.WithString("machine", mcp.Description("Input parameter: Machine type to use for this codespace")), + mcp.WithString("client_ip", mcp.Description("Input parameter: IP for location auto-detection when proxying a request")), + mcp.WithString("geo", mcp.Description("Input parameter: The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces `location`, which is closing down.")), ) return models.Tool{ diff --git a/MCP/go/tools/codespaces/codespaces_create_with_repo_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_create_with_repo_for_authenticated_user.go index 3ed3fba..7b66731 100644 --- a/MCP/go/tools/codespaces/codespaces_create_with_repo_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_create_with_repo_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Codespaces_create_with_repo_for_authenticated_userHandler(cfg *config.APICo if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Codespaces_create_with_repo_for_authenticated_userHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/codespaces%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/codespaces", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,17 +108,17 @@ func CreateCodespaces_create_with_repo_for_authenticated_userTool(cfg *config.AP mcp.WithDescription("Create a codespace in a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithBoolean("multi_repo_permissions_opt_out", mcp.Description("Input parameter: Whether to authorize requested permissions from devcontainer.json")), - mcp.WithNumber("retention_period_minutes", mcp.Description("Input parameter: Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).")), - mcp.WithString("display_name", mcp.Description("Input parameter: Display name for this codespace")), + mcp.WithString("client_ip", mcp.Description("Input parameter: IP for location auto-detection when proxying a request")), + mcp.WithString("devcontainer_path", mcp.Description("Input parameter: Path to devcontainer.json config to use for this codespace")), + mcp.WithString("machine", mcp.Description("Input parameter: Machine type to use for this codespace")), mcp.WithString("ref", mcp.Description("Input parameter: Git ref (typically a branch name) for this codespace")), + mcp.WithNumber("retention_period_minutes", mcp.Description("Input parameter: Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).")), mcp.WithString("geo", mcp.Description("Input parameter: The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces `location`, which is closing down.")), mcp.WithNumber("idle_timeout_minutes", mcp.Description("Input parameter: Time in minutes before codespace stops from inactivity")), + mcp.WithString("display_name", mcp.Description("Input parameter: Display name for this codespace")), mcp.WithString("location", mcp.Description("Input parameter: The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided.")), - mcp.WithString("machine", mcp.Description("Input parameter: Machine type to use for this codespace")), + mcp.WithBoolean("multi_repo_permissions_opt_out", mcp.Description("Input parameter: Whether to authorize requested permissions from devcontainer.json")), mcp.WithString("working_directory", mcp.Description("Input parameter: Working directory for this codespace")), - mcp.WithString("client_ip", mcp.Description("Input parameter: IP for location auto-detection when proxying a request")), - mcp.WithString("devcontainer_path", mcp.Description("Input parameter: Path to devcontainer.json config to use for this codespace")), ) return models.Tool{ diff --git a/MCP/go/tools/codespaces/codespaces_delete_codespaces_access_users.go b/MCP/go/tools/codespaces/codespaces_delete_codespaces_access_users.go index 43e77f6..1eaba91 100644 --- a/MCP/go/tools/codespaces/codespaces_delete_codespaces_access_users.go +++ b/MCP/go/tools/codespaces/codespaces_delete_codespaces_access_users.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_delete_codespaces_access_usersHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_delete_codespaces_access_usersHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/codespaces/access/selected_users%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/access/selected_users", cfg.BaseURL, org) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_delete_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_delete_for_authenticated_user.go index 706e388..1c87baf 100644 --- a/MCP/go/tools/codespaces/codespaces_delete_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_delete_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_delete_for_authenticated_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s", cfg.BaseURL, codespace_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_delete_from_organization.go b/MCP/go/tools/codespaces/codespaces_delete_from_organization.go index ca95bab..7524c81 100644 --- a/MCP/go/tools/codespaces/codespaces_delete_from_organization.go +++ b/MCP/go/tools/codespaces/codespaces_delete_from_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Codespaces_delete_from_organizationHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/members/%s/codespaces/%s%s", cfg.BaseURL, org, username, codespace_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/members/%s/codespaces/%s", cfg.BaseURL, org, username, codespace_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_delete_org_secret.go b/MCP/go/tools/codespaces/codespaces_delete_org_secret.go index 9f84b3a..6419b5c 100644 --- a/MCP/go/tools/codespaces/codespaces_delete_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_delete_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Codespaces_delete_org_secretHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_delete_repo_secret.go b/MCP/go/tools/codespaces/codespaces_delete_repo_secret.go index 8d4703f..5c5cc09 100644 --- a/MCP/go/tools/codespaces/codespaces_delete_repo_secret.go +++ b/MCP/go/tools/codespaces/codespaces_delete_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Codespaces_delete_repo_secretHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_delete_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_delete_secret_for_authenticated_user.go index 6efe868..08ef8b5 100644 --- a/MCP/go/tools/codespaces/codespaces_delete_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_delete_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_delete_secret_for_authenticated_userHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s%s", cfg.BaseURL, secret_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s", cfg.BaseURL, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_export_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_export_for_authenticated_user.go index 53531a6..e8a5822 100644 --- a/MCP/go/tools/codespaces/codespaces_export_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_export_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_export_for_authenticated_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s/exports%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s/exports", cfg.BaseURL, codespace_name) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_get_codespaces_for_user_in_org.go b/MCP/go/tools/codespaces/codespaces_get_codespaces_for_user_in_org.go index bc1f474..5cebefc 100644 --- a/MCP/go/tools/codespaces/codespaces_get_codespaces_for_user_in_org.go +++ b/MCP/go/tools/codespaces/codespaces_get_codespaces_for_user_in_org.go @@ -42,34 +42,6 @@ func Codespaces_get_codespaces_for_user_in_orgHandler(cfg *config.APIConfig) fun if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_get_codespaces_for_user_in_orgHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_get_export_details_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_get_export_details_for_authenticated_user.go index 35f94ec..1932d5f 100644 --- a/MCP/go/tools/codespaces/codespaces_get_export_details_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_get_export_details_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Codespaces_get_export_details_for_authenticated_userHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: export_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s/exports/%s%s", cfg.BaseURL, codespace_name, export_id, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s/exports/%s", cfg.BaseURL, codespace_name, export_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Codespaces_get_export_details_for_authenticated_userHandler(cfg *config.API return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespace_export_details if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_get_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_get_for_authenticated_user.go index 7335e6f..1f8469e 100644 --- a/MCP/go/tools/codespaces/codespaces_get_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_get_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_get_for_authenticated_userHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s", cfg.BaseURL, codespace_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_get_org_public_key.go b/MCP/go/tools/codespaces/codespaces_get_org_public_key.go index 1e09781..5d57a0e 100644 --- a/MCP/go/tools/codespaces/codespaces_get_org_public_key.go +++ b/MCP/go/tools/codespaces/codespaces_get_org_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_get_org_public_keyHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/public-key%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/public-key", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Codespaces_get_org_public_keyHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespaces_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_get_org_secret.go b/MCP/go/tools/codespaces/codespaces_get_org_secret.go index 05c0b8e..099b8ef 100644 --- a/MCP/go/tools/codespaces/codespaces_get_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_get_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Codespaces_get_org_secretHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Codespaces_get_org_secretHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespaces_org_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_get_public_key_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_get_public_key_for_authenticated_user.go index c3d8a69..5ce970d 100644 --- a/MCP/go/tools/codespaces/codespaces_get_public_key_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_get_public_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Codespaces_get_public_key_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/secrets/public-key%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/public-key", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -81,7 +50,7 @@ func Codespaces_get_public_key_for_authenticated_userHandler(cfg *config.APIConf return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespaces_user_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_get_repo_public_key.go b/MCP/go/tools/codespaces/codespaces_get_repo_public_key.go index 48a9d0f..ce10603 100644 --- a/MCP/go/tools/codespaces/codespaces_get_repo_public_key.go +++ b/MCP/go/tools/codespaces/codespaces_get_repo_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Codespaces_get_repo_public_keyHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/public-key%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/public-key", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Codespaces_get_repo_public_keyHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespaces_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_get_repo_secret.go b/MCP/go/tools/codespaces/codespaces_get_repo_secret.go index 6fd75e0..44c7c8f 100644 --- a/MCP/go/tools/codespaces/codespaces_get_repo_secret.go +++ b/MCP/go/tools/codespaces/codespaces_get_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Codespaces_get_repo_secretHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/codespaces/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Codespaces_get_repo_secretHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repo_codespaces_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_get_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_get_secret_for_authenticated_user.go index bbe6690..f51af37 100644 --- a/MCP/go/tools/codespaces/codespaces_get_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_get_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_get_secret_for_authenticated_userHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s%s", cfg.BaseURL, secret_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s", cfg.BaseURL, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Codespaces_get_secret_for_authenticated_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespaces_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_list_devcontainers_in_repository_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_list_devcontainers_in_repository_for_authenticated_user.go index e9c046f..56fbaf4 100644 --- a/MCP/go/tools/codespaces/codespaces_list_devcontainers_in_repository_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_list_devcontainers_in_repository_for_authenticated_user.go @@ -42,34 +42,6 @@ func Codespaces_list_devcontainers_in_repository_for_authenticated_userHandler(c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_list_devcontainers_in_repository_for_authenticated_userHandler(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_list_for_authenticated_user.go index 110eedb..66f0ffe 100644 --- a/MCP/go/tools/codespaces/codespaces_list_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_list_for_authenticated_user.go @@ -29,34 +29,6 @@ func Codespaces_list_for_authenticated_userHandler(cfg *config.APIConfig) func(c if val, ok := args["repository_id"]; ok { queryParams = append(queryParams, fmt.Sprintf("repository_id=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Codespaces_list_for_authenticated_userHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_in_organization.go b/MCP/go/tools/codespaces/codespaces_list_in_organization.go index 3f79b64..9c59611 100644 --- a/MCP/go/tools/codespaces/codespaces_list_in_organization.go +++ b/MCP/go/tools/codespaces/codespaces_list_in_organization.go @@ -34,34 +34,6 @@ func Codespaces_list_in_organizationHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Codespaces_list_in_organizationHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_in_repository_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_list_in_repository_for_authenticated_user.go index 1aa067d..4b28ffc 100644 --- a/MCP/go/tools/codespaces/codespaces_list_in_repository_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_list_in_repository_for_authenticated_user.go @@ -42,34 +42,6 @@ func Codespaces_list_in_repository_for_authenticated_userHandler(cfg *config.API if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_list_in_repository_for_authenticated_userHandler(cfg *config.API if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_org_secrets.go b/MCP/go/tools/codespaces/codespaces_list_org_secrets.go index 3480636..35a1f1f 100644 --- a/MCP/go/tools/codespaces/codespaces_list_org_secrets.go +++ b/MCP/go/tools/codespaces/codespaces_list_org_secrets.go @@ -34,34 +34,6 @@ func Codespaces_list_org_secretsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Codespaces_list_org_secretsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_repo_secrets.go b/MCP/go/tools/codespaces/codespaces_list_repo_secrets.go index 811138f..8d2f335 100644 --- a/MCP/go/tools/codespaces/codespaces_list_repo_secrets.go +++ b/MCP/go/tools/codespaces/codespaces_list_repo_secrets.go @@ -42,34 +42,6 @@ func Codespaces_list_repo_secretsHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_list_repo_secretsHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_repositories_for_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_list_repositories_for_secret_for_authenticated_user.go index cc1cd35..ae89c3e 100644 --- a/MCP/go/tools/codespaces/codespaces_list_repositories_for_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_list_repositories_for_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_list_repositories_for_secret_for_authenticated_userHandler(cfg * if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories%s", cfg.BaseURL, secret_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories", cfg.BaseURL, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_secrets_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_list_secrets_for_authenticated_user.go index 362363b..4a523ed 100644 --- a/MCP/go/tools/codespaces/codespaces_list_secrets_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_list_secrets_for_authenticated_user.go @@ -26,34 +26,6 @@ func Codespaces_list_secrets_for_authenticated_userHandler(cfg *config.APIConfig if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Codespaces_list_secrets_for_authenticated_userHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_list_selected_repos_for_org_secret.go b/MCP/go/tools/codespaces/codespaces_list_selected_repos_for_org_secret.go index 8231b8c..84352f9 100644 --- a/MCP/go/tools/codespaces/codespaces_list_selected_repos_for_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_list_selected_repos_for_org_secret.go @@ -42,34 +42,6 @@ func Codespaces_list_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_list_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_pre_flight_with_repo_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_pre_flight_with_repo_for_authenticated_user.go index f4291a1..77777c1 100644 --- a/MCP/go/tools/codespaces/codespaces_pre_flight_with_repo_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_pre_flight_with_repo_for_authenticated_user.go @@ -42,34 +42,6 @@ func Codespaces_pre_flight_with_repo_for_authenticated_userHandler(cfg *config.A if val, ok := args["client_ip"]; ok { queryParams = append(queryParams, fmt.Sprintf("client_ip=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Codespaces_pre_flight_with_repo_for_authenticated_userHandler(cfg *config.A if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_publish_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_publish_for_authenticated_user.go index de38b8f..10b72cd 100644 --- a/MCP/go/tools/codespaces/codespaces_publish_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_publish_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_publish_for_authenticated_userHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_publish_for_authenticated_userHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/codespaces/%s/publish%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s/publish", cfg.BaseURL, codespace_name) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Codespaces_publish_for_authenticated_userHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codespace_with_full_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/codespaces/codespaces_remove_repository_for_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_remove_repository_for_secret_for_authenticated_user.go index f272c69..cf5367e 100644 --- a/MCP/go/tools/codespaces/codespaces_remove_repository_for_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_remove_repository_for_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Codespaces_remove_repository_for_secret_for_authenticated_userHandler(cfg * if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories/%s%s", cfg.BaseURL, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories/%s", cfg.BaseURL, secret_name, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Codespaces_remove_repository_for_secret_for_authenticated_userHandler(cfg * } func CreateCodespaces_remove_repository_for_secret_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_user_codespaces_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("delete_user_codespaces_secrets_secret_name_repositories", mcp.WithDescription("Remove a selected repository from a user secret"), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), mcp.WithNumber("repository_id", mcp.Required(), mcp.Description("")), diff --git a/MCP/go/tools/codespaces/codespaces_remove_selected_repo_from_org_secret.go b/MCP/go/tools/codespaces/codespaces_remove_selected_repo_from_org_secret.go index 9e07e01..72c7401 100644 --- a/MCP/go/tools/codespaces/codespaces_remove_selected_repo_from_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_remove_selected_repo_from_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Codespaces_remove_selected_repo_from_org_secretHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s/repositories/%s%s", cfg.BaseURL, org, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s/repositories/%s", cfg.BaseURL, org, secret_name, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Codespaces_remove_selected_repo_from_org_secretHandler(cfg *config.APIConfi } func CreateCodespaces_remove_selected_repo_from_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_codespaces_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("delete_orgs_org_codespaces_secrets_secret_name_repositories", mcp.WithDescription("Remove selected repository from an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/codespaces/codespaces_repo_machines_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_repo_machines_for_authenticated_user.go index b520270..68c15a6 100644 --- a/MCP/go/tools/codespaces/codespaces_repo_machines_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_repo_machines_for_authenticated_user.go @@ -45,34 +45,6 @@ func Codespaces_repo_machines_for_authenticated_userHandler(cfg *config.APIConfi if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Codespaces_repo_machines_for_authenticated_userHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_set_codespaces_access.go b/MCP/go/tools/codespaces/codespaces_set_codespaces_access.go index 9dabb28..8f029f8 100644 --- a/MCP/go/tools/codespaces/codespaces_set_codespaces_access.go +++ b/MCP/go/tools/codespaces/codespaces_set_codespaces_access.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_set_codespaces_accessHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_set_codespaces_accessHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/codespaces/access%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/access", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -130,8 +99,8 @@ func CreateCodespaces_set_codespaces_accessTool(cfg *config.APIConfig) models.To tool := mcp.NewTool("put_orgs_org_codespaces_access", mcp.WithDescription("Manage access control for organization codespaces"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithArray("selected_usernames", mcp.Description("Input parameter: The usernames of the organization members who should have access to codespaces in the organization. Required when `visibility` is `selected_members`. The provided list of usernames will replace any existing value.")), mcp.WithString("visibility", mcp.Required(), mcp.Description("Input parameter: Which users can access codespaces in the organization. `disabled` means that no users can access codespaces in the organization.")), + mcp.WithArray("selected_usernames", mcp.Description("Input parameter: The usernames of the organization members who should have access to codespaces in the organization. Required when `visibility` is `selected_members`. The provided list of usernames will replace any existing value.")), ) return models.Tool{ diff --git a/MCP/go/tools/codespaces/codespaces_set_codespaces_access_users.go b/MCP/go/tools/codespaces/codespaces_set_codespaces_access_users.go index 112e34d..2633357 100644 --- a/MCP/go/tools/codespaces/codespaces_set_codespaces_access_users.go +++ b/MCP/go/tools/codespaces/codespaces_set_codespaces_access_users.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_set_codespaces_access_usersHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_set_codespaces_access_usersHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/codespaces/access/selected_users%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/access/selected_users", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_set_repositories_for_secret_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_set_repositories_for_secret_for_authenticated_user.go index 61964cc..cabdf59 100644 --- a/MCP/go/tools/codespaces/codespaces_set_repositories_for_secret_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_set_repositories_for_secret_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_set_repositories_for_secret_for_authenticated_userHandler(cfg *c if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_set_repositories_for_secret_for_authenticated_userHandler(cfg *c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories%s", cfg.BaseURL, secret_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/secrets/%s/repositories", cfg.BaseURL, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_set_selected_repos_for_org_secret.go b/MCP/go/tools/codespaces/codespaces_set_selected_repos_for_org_secret.go index 96a6487..aff5d32 100644 --- a/MCP/go/tools/codespaces/codespaces_set_selected_repos_for_org_secret.go +++ b/MCP/go/tools/codespaces/codespaces_set_selected_repos_for_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Codespaces_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Codespaces_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s/repositories%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/codespaces/secrets/%s/repositories", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Codespaces_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) } func CreateCodespaces_set_selected_repos_for_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_codespaces_secrets_secret_name_repositories", + tool := mcp.NewTool("put_orgs_org_codespaces_secrets_secret_name_repositories_2", mcp.WithDescription("Set selected repositories for an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/codespaces/codespaces_start_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_start_for_authenticated_user.go index 33a2b2a..b2c537e 100644 --- a/MCP/go/tools/codespaces/codespaces_start_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_start_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_start_for_authenticated_userHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s/start%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s/start", cfg.BaseURL, codespace_name) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_stop_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_stop_for_authenticated_user.go index eb7fcfe..a99a7fe 100644 --- a/MCP/go/tools/codespaces/codespaces_stop_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_stop_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Codespaces_stop_for_authenticated_userHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/codespaces/%s/stop%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s/stop", cfg.BaseURL, codespace_name) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/codespaces/codespaces_stop_in_organization.go b/MCP/go/tools/codespaces/codespaces_stop_in_organization.go index 6255c22..98cddb2 100644 --- a/MCP/go/tools/codespaces/codespaces_stop_in_organization.go +++ b/MCP/go/tools/codespaces/codespaces_stop_in_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Codespaces_stop_in_organizationHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/members/%s/codespaces/%s/stop%s", cfg.BaseURL, org, username, codespace_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/members/%s/codespaces/%s/stop", cfg.BaseURL, org, username, codespace_name) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Codespaces_stop_in_organizationHandler(cfg *config.APIConfig) func(ctx cont } func CreateCodespaces_stop_in_organizationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_members_username_codespaces_codespace_name_stop", + tool := mcp.NewTool("post_orgs_org_members_username_codespaces_codespace_name", mcp.WithDescription("Stop a codespace for an organization user"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("username", mcp.Required(), mcp.Description("The handle for the GitHub user account.")), diff --git a/MCP/go/tools/codespaces/codespaces_update_for_authenticated_user.go b/MCP/go/tools/codespaces/codespaces_update_for_authenticated_user.go index 26f6564..dfd2fbe 100644 --- a/MCP/go/tools/codespaces/codespaces_update_for_authenticated_user.go +++ b/MCP/go/tools/codespaces/codespaces_update_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Codespaces_update_for_authenticated_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: codespace_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Codespaces_update_for_authenticated_userHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/codespaces/%s%s", cfg.BaseURL, codespace_name, queryString) + url := fmt.Sprintf("%s/user/codespaces/%s", cfg.BaseURL, codespace_name) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -130,9 +99,9 @@ func CreateCodespaces_update_for_authenticated_userTool(cfg *config.APIConfig) m tool := mcp.NewTool("patch_user_codespaces_codespace_name", mcp.WithDescription("Update a codespace for the authenticated user"), mcp.WithString("codespace_name", mcp.Required(), mcp.Description("The name of the codespace.")), + mcp.WithString("display_name", mcp.Description("Input parameter: Display name for this codespace")), mcp.WithString("machine", mcp.Description("Input parameter: A valid machine to transition this codespace to.")), mcp.WithArray("recent_folders", mcp.Description("Input parameter: Recently opened folders inside the codespace. It is currently used by the clients to determine the folder path to load the codespace in.")), - mcp.WithString("display_name", mcp.Description("Input parameter: Display name for this codespace")), ) return models.Tool{ diff --git a/MCP/go/tools/copilot/copilot_add_copilot_seats_for_teams.go b/MCP/go/tools/copilot/copilot_add_copilot_seats_for_teams.go index 2e7ab73..ea1404b 100644 --- a/MCP/go/tools/copilot/copilot_add_copilot_seats_for_teams.go +++ b/MCP/go/tools/copilot/copilot_add_copilot_seats_for_teams.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Copilot_add_copilot_seats_for_teamsHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Copilot_add_copilot_seats_for_teamsHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_teams%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_teams", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/copilot/copilot_add_copilot_seats_for_users.go b/MCP/go/tools/copilot/copilot_add_copilot_seats_for_users.go index 1b6ff42..89652bc 100644 --- a/MCP/go/tools/copilot/copilot_add_copilot_seats_for_users.go +++ b/MCP/go/tools/copilot/copilot_add_copilot_seats_for_users.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Copilot_add_copilot_seats_for_usersHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Copilot_add_copilot_seats_for_usersHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_users%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_users", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_teams.go b/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_teams.go index 5468e74..8140266 100644 --- a/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_teams.go +++ b/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_teams.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Copilot_cancel_copilot_seat_assignment_for_teamsHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Copilot_cancel_copilot_seat_assignment_for_teamsHandler(cfg *config.APIConf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_teams%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_teams", cfg.BaseURL, org) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_users.go b/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_users.go index 3305a65..99c253a 100644 --- a/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_users.go +++ b/MCP/go/tools/copilot/copilot_cancel_copilot_seat_assignment_for_users.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Copilot_cancel_copilot_seat_assignment_for_usersHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Copilot_cancel_copilot_seat_assignment_for_usersHandler(cfg *config.APIConf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_users%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/copilot/billing/selected_users", cfg.BaseURL, org) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/copilot/copilot_copilot_metrics_for_organization.go b/MCP/go/tools/copilot/copilot_copilot_metrics_for_organization.go index 2602d5b..10fc0ae 100644 --- a/MCP/go/tools/copilot/copilot_copilot_metrics_for_organization.go +++ b/MCP/go/tools/copilot/copilot_copilot_metrics_for_organization.go @@ -40,34 +40,6 @@ func Copilot_copilot_metrics_for_organizationHandler(cfg *config.APIConfig) func if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Copilot_copilot_metrics_for_organizationHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Copilot_copilot_metrics_for_organizationHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Copilot_usage_metrics_day if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/copilot/copilot_copilot_metrics_for_team.go b/MCP/go/tools/copilot/copilot_copilot_metrics_for_team.go index 86dba3a..11bc190 100644 --- a/MCP/go/tools/copilot/copilot_copilot_metrics_for_team.go +++ b/MCP/go/tools/copilot/copilot_copilot_metrics_for_team.go @@ -48,34 +48,6 @@ func Copilot_copilot_metrics_for_teamHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Copilot_copilot_metrics_for_teamHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -113,7 +88,7 @@ func Copilot_copilot_metrics_for_teamHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Copilot_usage_metrics_day if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -129,7 +104,7 @@ func Copilot_copilot_metrics_for_teamHandler(cfg *config.APIConfig) func(ctx con } func CreateCopilot_copilot_metrics_for_teamTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_team_team_slug_copilot_metrics", + tool := mcp.NewTool("get_orgs_org_team_slug_copilot_metrics", mcp.WithDescription("Get Copilot metrics for a team"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/copilot/copilot_get_copilot_organization_details.go b/MCP/go/tools/copilot/copilot_get_copilot_organization_details.go index 7f96983..38af2ce 100644 --- a/MCP/go/tools/copilot/copilot_get_copilot_organization_details.go +++ b/MCP/go/tools/copilot/copilot_get_copilot_organization_details.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Copilot_get_copilot_organization_detailsHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/copilot/billing%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/copilot/billing", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Copilot_get_copilot_organization_detailsHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Copilot_organization_details if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/copilot/copilot_get_copilot_seat_details_for_user.go b/MCP/go/tools/copilot/copilot_get_copilot_seat_details_for_user.go index 4eecdfa..88e5534 100644 --- a/MCP/go/tools/copilot/copilot_get_copilot_seat_details_for_user.go +++ b/MCP/go/tools/copilot/copilot_get_copilot_seat_details_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Copilot_get_copilot_seat_details_for_userHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/members/%s/copilot%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/members/%s/copilot", cfg.BaseURL, org, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Copilot_get_copilot_seat_details_for_userHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Copilot_seat_details if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/copilot/copilot_list_copilot_seats.go b/MCP/go/tools/copilot/copilot_list_copilot_seats.go index 8ec5365..33ea26b 100644 --- a/MCP/go/tools/copilot/copilot_list_copilot_seats.go +++ b/MCP/go/tools/copilot/copilot_list_copilot_seats.go @@ -34,34 +34,6 @@ func Copilot_list_copilot_seatsHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Copilot_list_copilot_seatsHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/credentials/credentials_revoke.go b/MCP/go/tools/credentials/credentials_revoke.go index 2a904d6..e8d6e98 100644 --- a/MCP/go/tools/credentials/credentials_revoke.go +++ b/MCP/go/tools/credentials/credentials_revoke.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Credentials_revokeHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Credentials_revokeHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/credentials/revoke%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/credentials/revoke", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_add_selected_repo_to_org_secret.go b/MCP/go/tools/dependabot/dependabot_add_selected_repo_to_org_secret.go index d07b87a..f0d9570 100644 --- a/MCP/go/tools/dependabot/dependabot_add_selected_repo_to_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_add_selected_repo_to_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Dependabot_add_selected_repo_to_org_secretHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s/repositories/%s%s", cfg.BaseURL, org, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s/repositories/%s", cfg.BaseURL, org, secret_name, repository_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Dependabot_add_selected_repo_to_org_secretHandler(cfg *config.APIConfig) fu } func CreateDependabot_add_selected_repo_to_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_orgs_org_dependabot_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("put_orgs_org_dependabot_secrets_secret_name_repositories", mcp.WithDescription("Add selected repository to an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/dependabot/dependabot_create_or_update_org_secret.go b/MCP/go/tools/dependabot/dependabot_create_or_update_org_secret.go index 4b4cd81..e931560 100644 --- a/MCP/go/tools/dependabot/dependabot_create_or_update_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_create_or_update_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Dependabot_create_or_update_org_secretHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Dependabot_create_or_update_org_secretHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Dependabot_create_or_update_org_secretHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_create_or_update_repo_secret.go b/MCP/go/tools/dependabot/dependabot_create_or_update_repo_secret.go index 31ae185..7ac6fc6 100644 --- a/MCP/go/tools/dependabot/dependabot_create_or_update_repo_secret.go +++ b/MCP/go/tools/dependabot/dependabot_create_or_update_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Dependabot_create_or_update_repo_secretHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Dependabot_create_or_update_repo_secretHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Dependabot_create_or_update_repo_secretHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,8 +117,8 @@ func CreateDependabot_create_or_update_repo_secretTool(cfg *config.APIConfig) mo mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), - mcp.WithString("encrypted_value", mcp.Description("Input parameter: Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key) endpoint.")), mcp.WithString("key_id", mcp.Description("Input parameter: ID of the key you used to encrypt the secret.")), + mcp.WithString("encrypted_value", mcp.Description("Input parameter: Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key) endpoint.")), ) return models.Tool{ diff --git a/MCP/go/tools/dependabot/dependabot_delete_org_secret.go b/MCP/go/tools/dependabot/dependabot_delete_org_secret.go index cd9b7e2..bddf711 100644 --- a/MCP/go/tools/dependabot/dependabot_delete_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_delete_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Dependabot_delete_org_secretHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_delete_repo_secret.go b/MCP/go/tools/dependabot/dependabot_delete_repo_secret.go index 3160ded..50761a4 100644 --- a/MCP/go/tools/dependabot/dependabot_delete_repo_secret.go +++ b/MCP/go/tools/dependabot/dependabot_delete_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Dependabot_delete_repo_secretHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_get_alert.go b/MCP/go/tools/dependabot/dependabot_get_alert.go index 3b11160..5401c88 100644 --- a/MCP/go/tools/dependabot/dependabot_get_alert.go +++ b/MCP/go/tools/dependabot/dependabot_get_alert.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Dependabot_get_alertHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/dependabot/alerts/%s%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependabot/alerts/%s", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Dependabot_get_alertHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependabot_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_get_org_public_key.go b/MCP/go/tools/dependabot/dependabot_get_org_public_key.go index a1cf335..1edc52d 100644 --- a/MCP/go/tools/dependabot/dependabot_get_org_public_key.go +++ b/MCP/go/tools/dependabot/dependabot_get_org_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Dependabot_get_org_public_keyHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/public-key%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/public-key", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Dependabot_get_org_public_keyHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependabot_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_get_org_secret.go b/MCP/go/tools/dependabot/dependabot_get_org_secret.go index f0f0d01..c47959b 100644 --- a/MCP/go/tools/dependabot/dependabot_get_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_get_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Dependabot_get_org_secretHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Dependabot_get_org_secretHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_dependabot_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_get_repo_public_key.go b/MCP/go/tools/dependabot/dependabot_get_repo_public_key.go index 92dc314..4d230e6 100644 --- a/MCP/go/tools/dependabot/dependabot_get_repo_public_key.go +++ b/MCP/go/tools/dependabot/dependabot_get_repo_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Dependabot_get_repo_public_keyHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/public-key%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/public-key", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Dependabot_get_repo_public_keyHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependabot_public_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_get_repo_secret.go b/MCP/go/tools/dependabot/dependabot_get_repo_secret.go index 46625b3..641d8e6 100644 --- a/MCP/go/tools/dependabot/dependabot_get_repo_secret.go +++ b/MCP/go/tools/dependabot/dependabot_get_repo_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Dependabot_get_repo_secretHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/%s%s", cfg.BaseURL, owner, repo, secret_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependabot/secrets/%s", cfg.BaseURL, owner, repo, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Dependabot_get_repo_secretHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependabot_secret if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_list_alerts_for_enterprise.go b/MCP/go/tools/dependabot/dependabot_list_alerts_for_enterprise.go index 64f2f9b..6170646 100644 --- a/MCP/go/tools/dependabot/dependabot_list_alerts_for_enterprise.go +++ b/MCP/go/tools/dependabot/dependabot_list_alerts_for_enterprise.go @@ -70,34 +70,6 @@ func Dependabot_list_alerts_for_enterpriseHandler(cfg *config.APIConfig) func(ct if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -107,17 +79,20 @@ func Dependabot_list_alerts_for_enterpriseHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +110,7 @@ func Dependabot_list_alerts_for_enterpriseHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Dependabot_alert_with_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_list_alerts_for_org.go b/MCP/go/tools/dependabot/dependabot_list_alerts_for_org.go index b83f75b..cda2f7d 100644 --- a/MCP/go/tools/dependabot/dependabot_list_alerts_for_org.go +++ b/MCP/go/tools/dependabot/dependabot_list_alerts_for_org.go @@ -70,34 +70,6 @@ func Dependabot_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -107,17 +79,20 @@ func Dependabot_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +110,7 @@ func Dependabot_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Dependabot_alert_with_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_list_alerts_for_repo.go b/MCP/go/tools/dependabot/dependabot_list_alerts_for_repo.go index a1d229b..bc0d1ce 100644 --- a/MCP/go/tools/dependabot/dependabot_list_alerts_for_repo.go +++ b/MCP/go/tools/dependabot/dependabot_list_alerts_for_repo.go @@ -84,34 +84,6 @@ func Dependabot_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["last"]; ok { queryParams = append(queryParams, fmt.Sprintf("last=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -121,17 +93,20 @@ func Dependabot_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -149,7 +124,7 @@ func Dependabot_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Dependabot_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_list_org_secrets.go b/MCP/go/tools/dependabot/dependabot_list_org_secrets.go index f8738f6..8fd184f 100644 --- a/MCP/go/tools/dependabot/dependabot_list_org_secrets.go +++ b/MCP/go/tools/dependabot/dependabot_list_org_secrets.go @@ -34,34 +34,6 @@ func Dependabot_list_org_secretsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Dependabot_list_org_secretsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_list_repo_secrets.go b/MCP/go/tools/dependabot/dependabot_list_repo_secrets.go index 22d9741..0f57791 100644 --- a/MCP/go/tools/dependabot/dependabot_list_repo_secrets.go +++ b/MCP/go/tools/dependabot/dependabot_list_repo_secrets.go @@ -42,34 +42,6 @@ func Dependabot_list_repo_secretsHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Dependabot_list_repo_secretsHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_list_selected_repos_for_org_secret.go b/MCP/go/tools/dependabot/dependabot_list_selected_repos_for_org_secret.go index ba68f45..739a00f 100644 --- a/MCP/go/tools/dependabot/dependabot_list_selected_repos_for_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_list_selected_repos_for_org_secret.go @@ -42,34 +42,6 @@ func Dependabot_list_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Dependabot_list_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_remove_selected_repo_from_org_secret.go b/MCP/go/tools/dependabot/dependabot_remove_selected_repo_from_org_secret.go index 8cc4f1f..8169c90 100644 --- a/MCP/go/tools/dependabot/dependabot_remove_selected_repo_from_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_remove_selected_repo_from_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Dependabot_remove_selected_repo_from_org_secretHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: repository_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s/repositories/%s%s", cfg.BaseURL, org, secret_name, repository_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s/repositories/%s", cfg.BaseURL, org, secret_name, repository_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Dependabot_remove_selected_repo_from_org_secretHandler(cfg *config.APIConfi } func CreateDependabot_remove_selected_repo_from_org_secretTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_dependabot_secrets_secret_name_repositories_repository_id", + tool := mcp.NewTool("delete_orgs_org_dependabot_secrets_secret_name_repositories", mcp.WithDescription("Remove selected repository from an organization secret"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), diff --git a/MCP/go/tools/dependabot/dependabot_repository_access_for_org.go b/MCP/go/tools/dependabot/dependabot_repository_access_for_org.go index 3873322..51584fc 100644 --- a/MCP/go/tools/dependabot/dependabot_repository_access_for_org.go +++ b/MCP/go/tools/dependabot/dependabot_repository_access_for_org.go @@ -34,34 +34,6 @@ func Dependabot_repository_access_for_orgHandler(cfg *config.APIConfig) func(ctx if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Dependabot_repository_access_for_orgHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Dependabot_repository_access_for_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependabot_repository_access_details if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/dependabot/dependabot_set_repository_access_default_level.go b/MCP/go/tools/dependabot/dependabot_set_repository_access_default_level.go index f366c53..e03adea 100644 --- a/MCP/go/tools/dependabot/dependabot_set_repository_access_default_level.go +++ b/MCP/go/tools/dependabot/dependabot_set_repository_access_default_level.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Dependabot_set_repository_access_default_levelHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Dependabot_set_repository_access_default_levelHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/organizations/%s/dependabot/repository-access/default-level%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/organizations/%s/dependabot/repository-access/default-level", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Dependabot_set_repository_access_default_levelHandler(cfg *config.APIConfig } func CreateDependabot_set_repository_access_default_levelTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_organizations_org_dependabot_repository-access_default-level", + tool := mcp.NewTool("put_organizations_org_dependabot_repository-access", mcp.WithDescription("Set the default repository access level for Dependabot"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("default_level", mcp.Required(), mcp.Description("Input parameter: The default repository access level for Dependabot updates.")), diff --git a/MCP/go/tools/dependabot/dependabot_set_selected_repos_for_org_secret.go b/MCP/go/tools/dependabot/dependabot_set_selected_repos_for_org_secret.go index ccba990..7043711 100644 --- a/MCP/go/tools/dependabot/dependabot_set_selected_repos_for_org_secret.go +++ b/MCP/go/tools/dependabot/dependabot_set_selected_repos_for_org_secret.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Dependabot_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Dependabot_set_selected_repos_for_org_secretHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s/repositories%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/dependabot/secrets/%s/repositories", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependabot/dependabot_update_alert.go b/MCP/go/tools/dependabot/dependabot_update_alert.go index b6887dd..8d744a5 100644 --- a/MCP/go/tools/dependabot/dependabot_update_alert.go +++ b/MCP/go/tools/dependabot/dependabot_update_alert.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Dependabot_update_alertHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Dependabot_update_alertHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/dependabot/alerts/%s%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependabot/alerts/%s", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Dependabot_update_alertHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependabot_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,9 +117,9 @@ func CreateDependabot_update_alertTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("alert_number", mcp.Required(), mcp.Description("The number that identifies a Dependabot alert in its repository.\nYou can find this at the end of the URL for a Dependabot alert within GitHub,\nor in `number` fields in the response from the\n`GET /repos/{owner}/{repo}/dependabot/alerts` operation.")), - mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: The state of the Dependabot alert.\nA `dismissed_reason` must be provided when setting the state to `dismissed`.")), mcp.WithString("dismissed_comment", mcp.Description("Input parameter: An optional comment associated with dismissing the alert.")), mcp.WithString("dismissed_reason", mcp.Description("Input parameter: **Required when `state` is `dismissed`.** A reason for dismissing the alert.")), + mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: The state of the Dependabot alert.\nA `dismissed_reason` must be provided when setting the state to `dismissed`.")), ) return models.Tool{ diff --git a/MCP/go/tools/dependabot/dependabot_update_repository_access_for_org.go b/MCP/go/tools/dependabot/dependabot_update_repository_access_for_org.go index ca9196e..f2cd11a 100644 --- a/MCP/go/tools/dependabot/dependabot_update_repository_access_for_org.go +++ b/MCP/go/tools/dependabot/dependabot_update_repository_access_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Dependabot_update_repository_access_for_orgHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Dependabot_update_repository_access_for_orgHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/organizations/%s/dependabot/repository-access%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/organizations/%s/dependabot/repository-access", cfg.BaseURL, org) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependency_graph/dependency_graph_create_repository_snapshot.go b/MCP/go/tools/dependency_graph/dependency_graph_create_repository_snapshot.go index 299d178..e123af6 100644 --- a/MCP/go/tools/dependency_graph/dependency_graph_create_repository_snapshot.go +++ b/MCP/go/tools/dependency_graph/dependency_graph_create_repository_snapshot.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Dependency_graph_create_repository_snapshotHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody models.Snapshot @@ -85,23 +51,26 @@ func Dependency_graph_create_repository_snapshotHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/dependency-graph/snapshots%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependency-graph/snapshots", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,14 +108,14 @@ func CreateDependency_graph_create_repository_snapshotTool(cfg *config.APIConfig mcp.WithDescription("Create a snapshot of dependencies for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithObject("detector", mcp.Required(), mcp.Description("Input parameter: A description of the detector used.")), - mcp.WithObject("job", mcp.Required(), mcp.Description("")), - mcp.WithObject("manifests", mcp.Description("Input parameter: A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies.")), - mcp.WithObject("metadata", mcp.Description("Input parameter: User-defined metadata to store domain-specific information limited to 8 keys with scalar values.")), mcp.WithString("ref", mcp.Required(), mcp.Description("Input parameter: The repository branch that triggered this snapshot.")), mcp.WithString("scanned", mcp.Required(), mcp.Description("Input parameter: The time at which the snapshot was scanned.")), mcp.WithString("sha", mcp.Required(), mcp.Description("Input parameter: The commit SHA associated with this dependency snapshot. Maximum length: 40 characters.")), mcp.WithNumber("version", mcp.Required(), mcp.Description("Input parameter: The version of the repository snapshot submission.")), + mcp.WithObject("detector", mcp.Required(), mcp.Description("Input parameter: A description of the detector used.")), + mcp.WithObject("job", mcp.Required(), mcp.Description("")), + mcp.WithObject("manifests", mcp.Description("Input parameter: A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies.")), + mcp.WithObject("metadata", mcp.Description("Input parameter: User-defined metadata to store domain-specific information limited to 8 keys with scalar values.")), ) return models.Tool{ diff --git a/MCP/go/tools/dependency_graph/dependency_graph_diff_range.go b/MCP/go/tools/dependency_graph/dependency_graph_diff_range.go index 9751615..f293b2c 100644 --- a/MCP/go/tools/dependency_graph/dependency_graph_diff_range.go +++ b/MCP/go/tools/dependency_graph/dependency_graph_diff_range.go @@ -47,34 +47,6 @@ func Dependency_graph_diff_rangeHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["name"]; ok { queryParams = append(queryParams, fmt.Sprintf("name=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Dependency_graph_diff_rangeHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/dependency_graph/dependency_graph_export_sbom.go b/MCP/go/tools/dependency_graph/dependency_graph_export_sbom.go index 4c8ce2f..316e9f2 100644 --- a/MCP/go/tools/dependency_graph/dependency_graph_export_sbom.go +++ b/MCP/go/tools/dependency_graph/dependency_graph_export_sbom.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Dependency_graph_export_sbomHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/dependency-graph/sbom%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dependency-graph/sbom", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Dependency_graph_export_sbomHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Dependency_graph_spdx_sbom if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/emojis/emojis_get.go b/MCP/go/tools/emojis/emojis_get.go index 6114311..270e8b7 100644 --- a/MCP/go/tools/emojis/emojis_get.go +++ b/MCP/go/tools/emojis/emojis_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Emojis_getHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/emojis%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/emojis", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/gists/gists_check_is_starred.go b/MCP/go/tools/gists/gists_check_is_starred.go index 3ffb6a7..67b99dc 100644 --- a/MCP/go/tools/gists/gists_check_is_starred.go +++ b/MCP/go/tools/gists/gists_check_is_starred.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gists_check_is_starredHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/star%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s/star", cfg.BaseURL, gist_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/gists/gists_create.go b/MCP/go/tools/gists/gists_create.go index 1e350e5..5a55206 100644 --- a/MCP/go/tools/gists/gists_create.go +++ b/MCP/go/tools/gists/gists_create.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Gists_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Gists_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/gists%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/gists", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Gists_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_create_comment.go b/MCP/go/tools/gists/gists_create_comment.go index 93ba517..44fa9de 100644 --- a/MCP/go/tools/gists/gists_create_comment.go +++ b/MCP/go/tools/gists/gists_create_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Gists_create_commentHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Gists_create_commentHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/gists/%s/comments%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s/comments", cfg.BaseURL, gist_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Gists_create_commentHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_delete.go b/MCP/go/tools/gists/gists_delete.go index 919c40e..fe8ef33 100644 --- a/MCP/go/tools/gists/gists_delete.go +++ b/MCP/go/tools/gists/gists_delete.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gists_deleteHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s", cfg.BaseURL, gist_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/gists/gists_delete_comment.go b/MCP/go/tools/gists/gists_delete_comment.go index da17fb4..2884750 100644 --- a/MCP/go/tools/gists/gists_delete_comment.go +++ b/MCP/go/tools/gists/gists_delete_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Gists_delete_commentHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/comments/%s%s", cfg.BaseURL, gist_id, comment_id, queryString) + url := fmt.Sprintf("%s/gists/%s/comments/%s", cfg.BaseURL, gist_id, comment_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Gists_delete_commentHandler(cfg *config.APIConfig) func(ctx context.Context } func CreateGists_delete_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_gists_gist_id_comments_comment_id", + tool := mcp.NewTool("delete_gists_gist_id_comments_comment", mcp.WithDescription("Delete a gist comment"), mcp.WithString("gist_id", mcp.Required(), mcp.Description("The unique identifier of the gist.")), mcp.WithNumber("comment_id", mcp.Required(), mcp.Description("The unique identifier of the comment.")), diff --git a/MCP/go/tools/gists/gists_fork.go b/MCP/go/tools/gists/gists_fork.go index a54b92a..3085e0a 100644 --- a/MCP/go/tools/gists/gists_fork.go +++ b/MCP/go/tools/gists/gists_fork.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gists_forkHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/forks%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s/forks", cfg.BaseURL, gist_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Gists_forkHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Base_gist if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_get.go b/MCP/go/tools/gists/gists_get.go index 1753279..b798303 100644 --- a/MCP/go/tools/gists/gists_get.go +++ b/MCP/go/tools/gists/gists_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gists_getHandler(cfg *config.APIConfig) func(ctx context.Context, request m if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s", cfg.BaseURL, gist_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Gists_getHandler(cfg *config.APIConfig) func(ctx context.Context, request m return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_get_comment.go b/MCP/go/tools/gists/gists_get_comment.go index 39e11a7..019b391 100644 --- a/MCP/go/tools/gists/gists_get_comment.go +++ b/MCP/go/tools/gists/gists_get_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Gists_get_commentHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/comments/%s%s", cfg.BaseURL, gist_id, comment_id, queryString) + url := fmt.Sprintf("%s/gists/%s/comments/%s", cfg.BaseURL, gist_id, comment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Gists_get_commentHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Gists_get_commentHandler(cfg *config.APIConfig) func(ctx context.Context, r } func CreateGists_get_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_gists_gist_id_comments_comment_id", + tool := mcp.NewTool("get_gists_gist_id_comments_comment", mcp.WithDescription("Get a gist comment"), mcp.WithString("gist_id", mcp.Required(), mcp.Description("The unique identifier of the gist.")), mcp.WithNumber("comment_id", mcp.Required(), mcp.Description("The unique identifier of the comment.")), diff --git a/MCP/go/tools/gists/gists_get_revision.go b/MCP/go/tools/gists/gists_get_revision.go index 3651f5c..8ebe293 100644 --- a/MCP/go/tools/gists/gists_get_revision.go +++ b/MCP/go/tools/gists/gists_get_revision.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Gists_get_revisionHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/%s%s", cfg.BaseURL, gist_id, sha, queryString) + url := fmt.Sprintf("%s/gists/%s/%s", cfg.BaseURL, gist_id, sha) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Gists_get_revisionHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list.go b/MCP/go/tools/gists/gists_list.go index b246cb0..80fcee3 100644 --- a/MCP/go/tools/gists/gists_list.go +++ b/MCP/go/tools/gists/gists_list.go @@ -29,34 +29,6 @@ func Gists_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Gists_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -94,7 +69,7 @@ func Gists_listHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Base_gist if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list_comments.go b/MCP/go/tools/gists/gists_list_comments.go index 92cba15..878e35a 100644 --- a/MCP/go/tools/gists/gists_list_comments.go +++ b/MCP/go/tools/gists/gists_list_comments.go @@ -34,34 +34,6 @@ func Gists_list_commentsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Gists_list_commentsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Gists_list_commentsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Gist_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list_commits.go b/MCP/go/tools/gists/gists_list_commits.go index 5f7717b..6c0ea45 100644 --- a/MCP/go/tools/gists/gists_list_commits.go +++ b/MCP/go/tools/gists/gists_list_commits.go @@ -34,34 +34,6 @@ func Gists_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Gists_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Gists_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Gist_commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list_for_user.go b/MCP/go/tools/gists/gists_list_for_user.go index 205415e..54d95cc 100644 --- a/MCP/go/tools/gists/gists_list_for_user.go +++ b/MCP/go/tools/gists/gists_list_for_user.go @@ -37,34 +37,6 @@ func Gists_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Gists_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Gists_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Base_gist if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list_forks.go b/MCP/go/tools/gists/gists_list_forks.go index 989880e..7acf030 100644 --- a/MCP/go/tools/gists/gists_list_forks.go +++ b/MCP/go/tools/gists/gists_list_forks.go @@ -34,34 +34,6 @@ func Gists_list_forksHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Gists_list_forksHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Gists_list_forksHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Gist_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list_public.go b/MCP/go/tools/gists/gists_list_public.go index 298afc0..b9ca3be 100644 --- a/MCP/go/tools/gists/gists_list_public.go +++ b/MCP/go/tools/gists/gists_list_public.go @@ -29,34 +29,6 @@ func Gists_list_publicHandler(cfg *config.APIConfig) func(ctx context.Context, r if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Gists_list_publicHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -94,7 +69,7 @@ func Gists_list_publicHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Base_gist if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_list_starred.go b/MCP/go/tools/gists/gists_list_starred.go index 329bf6d..f566ad1 100644 --- a/MCP/go/tools/gists/gists_list_starred.go +++ b/MCP/go/tools/gists/gists_list_starred.go @@ -29,34 +29,6 @@ func Gists_list_starredHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Gists_list_starredHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -94,7 +69,7 @@ func Gists_list_starredHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Base_gist if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_star.go b/MCP/go/tools/gists/gists_star.go index d7e40ad..6b3ec62 100644 --- a/MCP/go/tools/gists/gists_star.go +++ b/MCP/go/tools/gists/gists_star.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gists_starHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/star%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s/star", cfg.BaseURL, gist_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/gists/gists_unstar.go b/MCP/go/tools/gists/gists_unstar.go index b817468..74ed22f 100644 --- a/MCP/go/tools/gists/gists_unstar.go +++ b/MCP/go/tools/gists/gists_unstar.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gists_unstarHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gists/%s/star%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s/star", cfg.BaseURL, gist_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/gists/gists_update.go b/MCP/go/tools/gists/gists_update.go index 193db79..b1b0132 100644 --- a/MCP/go/tools/gists/gists_update.go +++ b/MCP/go/tools/gists/gists_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Gists_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: gist_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Gists_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/gists/%s%s", cfg.BaseURL, gist_id, queryString) + url := fmt.Sprintf("%s/gists/%s", cfg.BaseURL, gist_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Gists_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/gists/gists_update_comment.go b/MCP/go/tools/gists/gists_update_comment.go index d2b670c..819e830 100644 --- a/MCP/go/tools/gists/gists_update_comment.go +++ b/MCP/go/tools/gists/gists_update_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Gists_update_commentHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Gists_update_commentHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/gists/%s/comments/%s%s", cfg.BaseURL, gist_id, comment_id, queryString) + url := fmt.Sprintf("%s/gists/%s/comments/%s", cfg.BaseURL, gist_id, comment_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Gists_update_commentHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gist_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -135,7 +104,7 @@ func Gists_update_commentHandler(cfg *config.APIConfig) func(ctx context.Context } func CreateGists_update_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_gists_gist_id_comments_comment_id", + tool := mcp.NewTool("patch_gists_gist_id_comments_comment", mcp.WithDescription("Update a gist comment"), mcp.WithString("gist_id", mcp.Required(), mcp.Description("The unique identifier of the gist.")), mcp.WithNumber("comment_id", mcp.Required(), mcp.Description("The unique identifier of the comment.")), diff --git a/MCP/go/tools/git/git_create_blob.go b/MCP/go/tools/git/git_create_blob.go index 1ec6703..dfb2f2a 100644 --- a/MCP/go/tools/git/git_create_blob.go +++ b/MCP/go/tools/git/git_create_blob.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Git_create_blobHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Git_create_blobHandler(cfg *config.APIConfig) func(ctx context.Context, req if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/git/blobs%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/blobs", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Git_create_blobHandler(cfg *config.APIConfig) func(ctx context.Context, req return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Short_blob if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_create_commit.go b/MCP/go/tools/git/git_create_commit.go index 279763c..e28c0b2 100644 --- a/MCP/go/tools/git/git_create_commit.go +++ b/MCP/go/tools/git/git_create_commit.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Git_create_commitHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Git_create_commitHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/git/commits%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/commits", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Git_create_commitHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,12 +108,12 @@ func CreateGit_create_commitTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a commit"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The commit message")), + mcp.WithArray("parents", mcp.Description("Input parameter: The full SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided.")), mcp.WithString("signature", mcp.Description("Input parameter: The [PGP signature](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) of the commit. GitHub adds the signature to the `gpgsig` header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a `signature` parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to [use the command line](https://git-scm.com/book/id/v2/Git-Tools-Signing-Your-Work) to create signed commits.")), mcp.WithString("tree", mcp.Required(), mcp.Description("Input parameter: The SHA of the tree object this commit points to")), mcp.WithObject("author", mcp.Description("Input parameter: Information about the author of the commit. By default, the `author` will be the authenticated user and the current date. See the `author` and `committer` object below for details.")), mcp.WithObject("committer", mcp.Description("Input parameter: Information about the person who is making the commit. By default, `committer` will use the information set in `author`. See the `author` and `committer` object below for details.")), - mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The commit message")), - mcp.WithArray("parents", mcp.Description("Input parameter: The full SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided.")), ) return models.Tool{ diff --git a/MCP/go/tools/git/git_create_ref.go b/MCP/go/tools/git/git_create_ref.go index 8d3d4b3..aa7a382 100644 --- a/MCP/go/tools/git/git_create_ref.go +++ b/MCP/go/tools/git/git_create_ref.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Git_create_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Git_create_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/git/refs%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/refs", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Git_create_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_ref if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_create_tag.go b/MCP/go/tools/git/git_create_tag.go index dccc319..2d97434 100644 --- a/MCP/go/tools/git/git_create_tag.go +++ b/MCP/go/tools/git/git_create_tag.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Git_create_tagHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Git_create_tagHandler(cfg *config.APIConfig) func(ctx context.Context, requ if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/git/tags%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/tags", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Git_create_tagHandler(cfg *config.APIConfig) func(ctx context.Context, requ return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_tag if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,11 +108,11 @@ func CreateGit_create_tagTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a tag object"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The tag message.")), mcp.WithString("object", mcp.Required(), mcp.Description("Input parameter: The SHA of the git object this is tagging.")), mcp.WithString("tag", mcp.Required(), mcp.Description("Input parameter: The tag's name. This is typically a version (e.g., \"v0.0.1\").")), mcp.WithObject("tagger", mcp.Description("Input parameter: An object with information about the individual creating the tag.")), mcp.WithString("type", mcp.Required(), mcp.Description("Input parameter: The type of the object we're tagging. Normally this is a `commit` but it can also be a `tree` or a `blob`.")), - mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The tag message.")), ) return models.Tool{ diff --git a/MCP/go/tools/git/git_create_tree.go b/MCP/go/tools/git/git_create_tree.go index 60ff7f8..e2da202 100644 --- a/MCP/go/tools/git/git_create_tree.go +++ b/MCP/go/tools/git/git_create_tree.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Git_create_treeHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Git_create_treeHandler(cfg *config.APIConfig) func(ctx context.Context, req if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/git/trees%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/trees", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Git_create_treeHandler(cfg *config.APIConfig) func(ctx context.Context, req return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_tree if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_delete_ref.go b/MCP/go/tools/git/git_delete_ref.go index 0236553..c744264 100644 --- a/MCP/go/tools/git/git_delete_ref.go +++ b/MCP/go/tools/git/git_delete_ref.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Git_delete_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: ref"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/git/refs/%s%s", cfg.BaseURL, owner, repo, ref, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/refs/%s", cfg.BaseURL, owner, repo, ref) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/git/git_get_blob.go b/MCP/go/tools/git/git_get_blob.go index e9f09fb..fbeaf71 100644 --- a/MCP/go/tools/git/git_get_blob.go +++ b/MCP/go/tools/git/git_get_blob.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Git_get_blobHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: file_sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/git/blobs/%s%s", cfg.BaseURL, owner, repo, file_sha, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/blobs/%s", cfg.BaseURL, owner, repo, file_sha) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/git/git_get_commit.go b/MCP/go/tools/git/git_get_commit.go index 8b06ee7..c7ec44d 100644 --- a/MCP/go/tools/git/git_get_commit.go +++ b/MCP/go/tools/git/git_get_commit.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Git_get_commitHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: commit_sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/git/commits/%s%s", cfg.BaseURL, owner, repo, commit_sha, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/commits/%s", cfg.BaseURL, owner, repo, commit_sha) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Git_get_commitHandler(cfg *config.APIConfig) func(ctx context.Context, requ return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_get_ref.go b/MCP/go/tools/git/git_get_ref.go index 5e735d6..b48d477 100644 --- a/MCP/go/tools/git/git_get_ref.go +++ b/MCP/go/tools/git/git_get_ref.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Git_get_refHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: ref"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/git/ref/%s%s", cfg.BaseURL, owner, repo, ref, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/ref/%s", cfg.BaseURL, owner, repo, ref) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Git_get_refHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_ref if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Git_get_refHandler(cfg *config.APIConfig) func(ctx context.Context, request } func CreateGit_get_refTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_git_ref_ref", + tool := mcp.NewTool("get_repos_owner_repo_git_ref", mcp.WithDescription("Get a reference"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/git/git_get_tag.go b/MCP/go/tools/git/git_get_tag.go index e09a8e6..9b92be5 100644 --- a/MCP/go/tools/git/git_get_tag.go +++ b/MCP/go/tools/git/git_get_tag.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Git_get_tagHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: tag_sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/git/tags/%s%s", cfg.BaseURL, owner, repo, tag_sha, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/tags/%s", cfg.BaseURL, owner, repo, tag_sha) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Git_get_tagHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_tag if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_get_tree.go b/MCP/go/tools/git/git_get_tree.go index 605f092..336819a 100644 --- a/MCP/go/tools/git/git_get_tree.go +++ b/MCP/go/tools/git/git_get_tree.go @@ -47,34 +47,6 @@ func Git_get_treeHandler(cfg *config.APIConfig) func(ctx context.Context, reques if val, ok := args["recursive"]; ok { queryParams = append(queryParams, fmt.Sprintf("recursive=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Git_get_treeHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Git_get_treeHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_tree if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_list_matching_refs.go b/MCP/go/tools/git/git_list_matching_refs.go index 53cc891..71e1408 100644 --- a/MCP/go/tools/git/git_list_matching_refs.go +++ b/MCP/go/tools/git/git_list_matching_refs.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Git_list_matching_refsHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: ref"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/git/matching-refs/%s%s", cfg.BaseURL, owner, repo, ref, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/matching-refs/%s", cfg.BaseURL, owner, repo, ref) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Git_list_matching_refsHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Git_ref if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/git/git_update_ref.go b/MCP/go/tools/git/git_update_ref.go index dcfa7b4..7ad2f15 100644 --- a/MCP/go/tools/git/git_update_ref.go +++ b/MCP/go/tools/git/git_update_ref.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Git_update_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: ref"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Git_update_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/git/refs/%s%s", cfg.BaseURL, owner, repo, ref, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/git/refs/%s", cfg.BaseURL, owner, repo, ref) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Git_update_refHandler(cfg *config.APIConfig) func(ctx context.Context, requ return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Git_ref if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,8 +117,8 @@ func CreateGit_update_refTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("ref", mcp.Required(), mcp.Description("The Git reference. For more information, see \"[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)\" in the Git documentation.")), - mcp.WithBoolean("force", mcp.Description("Input parameter: Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work.")), mcp.WithString("sha", mcp.Required(), mcp.Description("Input parameter: The SHA1 value to set this reference to")), + mcp.WithBoolean("force", mcp.Description("Input parameter: Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work.")), ) return models.Tool{ diff --git a/MCP/go/tools/gitignore/gitignore_get_all_templates.go b/MCP/go/tools/gitignore/gitignore_get_all_templates.go index 8bc0035..b6484c5 100644 --- a/MCP/go/tools/gitignore/gitignore_get_all_templates.go +++ b/MCP/go/tools/gitignore/gitignore_get_all_templates.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Gitignore_get_all_templatesHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gitignore/templates%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/gitignore/templates", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/gitignore/gitignore_get_template.go b/MCP/go/tools/gitignore/gitignore_get_template.go index 353c2e8..8182e32 100644 --- a/MCP/go/tools/gitignore/gitignore_get_template.go +++ b/MCP/go/tools/gitignore/gitignore_get_template.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Gitignore_get_templateHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/gitignore/templates/%s%s", cfg.BaseURL, name, queryString) + url := fmt.Sprintf("%s/gitignore/templates/%s", cfg.BaseURL, name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Gitignore_get_templateHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gitignore_template if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/hosted_compute/hosted_compute_create_network_configuration_for_org.go b/MCP/go/tools/hosted_compute/hosted_compute_create_network_configuration_for_org.go index 8eb2ac7..6f45176 100644 --- a/MCP/go/tools/hosted_compute/hosted_compute_create_network_configuration_for_org.go +++ b/MCP/go/tools/hosted_compute/hosted_compute_create_network_configuration_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Hosted_compute_create_network_configuration_for_orgHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Hosted_compute_create_network_configuration_for_orgHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Hosted_compute_create_network_configuration_for_orgHandler(cfg *config.APIC return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Network_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/hosted_compute/hosted_compute_delete_network_configuration_from_org.go b/MCP/go/tools/hosted_compute/hosted_compute_delete_network_configuration_from_org.go index ca8beef..1fd20ea 100644 --- a/MCP/go/tools/hosted_compute/hosted_compute_delete_network_configuration_from_org.go +++ b/MCP/go/tools/hosted_compute/hosted_compute_delete_network_configuration_from_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Hosted_compute_delete_network_configuration_from_orgHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: network_configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations/%s%s", cfg.BaseURL, org, network_configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations/%s", cfg.BaseURL, org, network_configuration_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Hosted_compute_delete_network_configuration_from_orgHandler(cfg *config.API } func CreateHosted_compute_delete_network_configuration_from_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_settings_network-configurations_network_configuration_id", + tool := mcp.NewTool("delete_orgs_org_settings_network-configurations_network", mcp.WithDescription("Delete a hosted compute network configuration from an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("network_configuration_id", mcp.Required(), mcp.Description("Unique identifier of the hosted compute network configuration.")), diff --git a/MCP/go/tools/hosted_compute/hosted_compute_get_network_configuration_for_org.go b/MCP/go/tools/hosted_compute/hosted_compute_get_network_configuration_for_org.go index 6a9b197..0c192d4 100644 --- a/MCP/go/tools/hosted_compute/hosted_compute_get_network_configuration_for_org.go +++ b/MCP/go/tools/hosted_compute/hosted_compute_get_network_configuration_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Hosted_compute_get_network_configuration_for_orgHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: network_configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations/%s%s", cfg.BaseURL, org, network_configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations/%s", cfg.BaseURL, org, network_configuration_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Hosted_compute_get_network_configuration_for_orgHandler(cfg *config.APIConf return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Network_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Hosted_compute_get_network_configuration_for_orgHandler(cfg *config.APIConf } func CreateHosted_compute_get_network_configuration_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_settings_network-configurations_network_configuration_id", + tool := mcp.NewTool("get_orgs_org_settings_network-configurations_network", mcp.WithDescription("Get a hosted compute network configuration for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("network_configuration_id", mcp.Required(), mcp.Description("Unique identifier of the hosted compute network configuration.")), diff --git a/MCP/go/tools/hosted_compute/hosted_compute_get_network_settings_for_org.go b/MCP/go/tools/hosted_compute/hosted_compute_get_network_settings_for_org.go index d0fc0d3..065c0b3 100644 --- a/MCP/go/tools/hosted_compute/hosted_compute_get_network_settings_for_org.go +++ b/MCP/go/tools/hosted_compute/hosted_compute_get_network_settings_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Hosted_compute_get_network_settings_for_orgHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: network_settings_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/settings/network-settings/%s%s", cfg.BaseURL, org, network_settings_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/network-settings/%s", cfg.BaseURL, org, network_settings_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Hosted_compute_get_network_settings_for_orgHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Network_settings if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Hosted_compute_get_network_settings_for_orgHandler(cfg *config.APIConfig) f } func CreateHosted_compute_get_network_settings_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_settings_network-settings_network_settings_id", + tool := mcp.NewTool("get_orgs_org_settings_network-settings_network_id", mcp.WithDescription("Get a hosted compute network settings resource for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("network_settings_id", mcp.Required(), mcp.Description("Unique identifier of the hosted compute network settings.")), diff --git a/MCP/go/tools/hosted_compute/hosted_compute_list_network_configurations_for_org.go b/MCP/go/tools/hosted_compute/hosted_compute_list_network_configurations_for_org.go index 4a3256d..226ac27 100644 --- a/MCP/go/tools/hosted_compute/hosted_compute_list_network_configurations_for_org.go +++ b/MCP/go/tools/hosted_compute/hosted_compute_list_network_configurations_for_org.go @@ -34,34 +34,6 @@ func Hosted_compute_list_network_configurations_for_orgHandler(cfg *config.APICo if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Hosted_compute_list_network_configurations_for_orgHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/hosted_compute/hosted_compute_update_network_configuration_for_org.go b/MCP/go/tools/hosted_compute/hosted_compute_update_network_configuration_for_org.go index 451766e..7dee0a3 100644 --- a/MCP/go/tools/hosted_compute/hosted_compute_update_network_configuration_for_org.go +++ b/MCP/go/tools/hosted_compute/hosted_compute_update_network_configuration_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Hosted_compute_update_network_configuration_for_orgHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: network_configuration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Hosted_compute_update_network_configuration_for_orgHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations/%s%s", cfg.BaseURL, org, network_configuration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/settings/network-configurations/%s", cfg.BaseURL, org, network_configuration_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Hosted_compute_update_network_configuration_for_orgHandler(cfg *config.APIC return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Network_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -135,13 +104,13 @@ func Hosted_compute_update_network_configuration_for_orgHandler(cfg *config.APIC } func CreateHosted_compute_update_network_configuration_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_orgs_org_settings_network-configurations_network_configuration_id", + tool := mcp.NewTool("patch_orgs_org_settings_network-configurations_network", mcp.WithDescription("Update a hosted compute network configuration for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("network_configuration_id", mcp.Required(), mcp.Description("Unique identifier of the hosted compute network configuration.")), - mcp.WithString("name", mcp.Description("Input parameter: Name of the network configuration. Must be between 1 and 100 characters and may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'.")), mcp.WithArray("network_settings_ids", mcp.Description("Input parameter: The identifier of the network settings to use for the network configuration. Exactly one network settings must be specified.")), mcp.WithString("compute_service", mcp.Description("Input parameter: The hosted compute service to use for the network configuration.")), + mcp.WithString("name", mcp.Description("Input parameter: Name of the network configuration. Must be between 1 and 100 characters and may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'.")), ) return models.Tool{ diff --git a/MCP/go/tools/interactions/interactions_get_restrictions_for_authenticated_user.go b/MCP/go/tools/interactions/interactions_get_restrictions_for_authenticated_user.go index 03bd257..fd80592 100644 --- a/MCP/go/tools/interactions/interactions_get_restrictions_for_authenticated_user.go +++ b/MCP/go/tools/interactions/interactions_get_restrictions_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Interactions_get_restrictions_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/interaction-limits%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/interaction-limits", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/interactions/interactions_get_restrictions_for_org.go b/MCP/go/tools/interactions/interactions_get_restrictions_for_org.go index 837bc4f..6851ce6 100644 --- a/MCP/go/tools/interactions/interactions_get_restrictions_for_org.go +++ b/MCP/go/tools/interactions/interactions_get_restrictions_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Interactions_get_restrictions_for_orgHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/interaction-limits%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/interaction-limits", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/interactions/interactions_get_restrictions_for_repo.go b/MCP/go/tools/interactions/interactions_get_restrictions_for_repo.go index 515b51e..6bd147a 100644 --- a/MCP/go/tools/interactions/interactions_get_restrictions_for_repo.go +++ b/MCP/go/tools/interactions/interactions_get_restrictions_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Interactions_get_restrictions_for_repoHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/interaction-limits%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/interaction-limits", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/interactions/interactions_remove_restrictions_for_authenticated_user.go b/MCP/go/tools/interactions/interactions_remove_restrictions_for_authenticated_user.go index 7bbd4ab..d6a41bd 100644 --- a/MCP/go/tools/interactions/interactions_remove_restrictions_for_authenticated_user.go +++ b/MCP/go/tools/interactions/interactions_remove_restrictions_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Interactions_remove_restrictions_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/interaction-limits%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/interaction-limits", cfg.BaseURL) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/interactions/interactions_remove_restrictions_for_org.go b/MCP/go/tools/interactions/interactions_remove_restrictions_for_org.go index 2b71b3a..13c0e67 100644 --- a/MCP/go/tools/interactions/interactions_remove_restrictions_for_org.go +++ b/MCP/go/tools/interactions/interactions_remove_restrictions_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Interactions_remove_restrictions_for_orgHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/interaction-limits%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/interaction-limits", cfg.BaseURL, org) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/interactions/interactions_remove_restrictions_for_repo.go b/MCP/go/tools/interactions/interactions_remove_restrictions_for_repo.go index 4bcc321..e111e18 100644 --- a/MCP/go/tools/interactions/interactions_remove_restrictions_for_repo.go +++ b/MCP/go/tools/interactions/interactions_remove_restrictions_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Interactions_remove_restrictions_for_repoHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/interaction-limits%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/interaction-limits", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/interactions/interactions_set_restrictions_for_authenticated_user.go b/MCP/go/tools/interactions/interactions_set_restrictions_for_authenticated_user.go index 83b18b4..5f3d430 100644 --- a/MCP/go/tools/interactions/interactions_set_restrictions_for_authenticated_user.go +++ b/MCP/go/tools/interactions/interactions_set_restrictions_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,41 +19,8 @@ func Interactions_set_restrictions_for_authenticated_userHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Interaction_limit // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -69,23 +35,26 @@ func Interactions_set_restrictions_for_authenticated_userHandler(cfg *config.API if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/interaction-limits%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/interaction-limits", cfg.BaseURL) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Interactions_set_restrictions_for_authenticated_userHandler(cfg *config.API return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Interaction_limit_response if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -121,8 +90,8 @@ func Interactions_set_restrictions_for_authenticated_userHandler(cfg *config.API func CreateInteractions_set_restrictions_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("put_user_interaction-limits", mcp.WithDescription("Set interaction restrictions for your public repositories"), - mcp.WithString("expiry", mcp.Description("Input parameter: The duration of the interaction restriction. Default: `one_day`.")), mcp.WithString("limit", mcp.Required(), mcp.Description("Input parameter: The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect.")), + mcp.WithString("expiry", mcp.Description("Input parameter: The duration of the interaction restriction. Default: `one_day`.")), ) return models.Tool{ diff --git a/MCP/go/tools/interactions/interactions_set_restrictions_for_org.go b/MCP/go/tools/interactions/interactions_set_restrictions_for_org.go index cc78e07..f734bd7 100644 --- a/MCP/go/tools/interactions/interactions_set_restrictions_for_org.go +++ b/MCP/go/tools/interactions/interactions_set_restrictions_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,41 +27,8 @@ func Interactions_set_restrictions_for_orgHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Interaction_limit // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -77,23 +43,26 @@ func Interactions_set_restrictions_for_orgHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/interaction-limits%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/interaction-limits", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Interactions_set_restrictions_for_orgHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Interaction_limit_response if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,8 +99,8 @@ func CreateInteractions_set_restrictions_for_orgTool(cfg *config.APIConfig) mode tool := mcp.NewTool("put_orgs_org_interaction-limits", mcp.WithDescription("Set interaction restrictions for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("expiry", mcp.Description("Input parameter: The duration of the interaction restriction. Default: `one_day`.")), mcp.WithString("limit", mcp.Required(), mcp.Description("Input parameter: The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect.")), + mcp.WithString("expiry", mcp.Description("Input parameter: The duration of the interaction restriction. Default: `one_day`.")), ) return models.Tool{ diff --git a/MCP/go/tools/interactions/interactions_set_restrictions_for_repo.go b/MCP/go/tools/interactions/interactions_set_restrictions_for_repo.go index 7929468..56dee81 100644 --- a/MCP/go/tools/interactions/interactions_set_restrictions_for_repo.go +++ b/MCP/go/tools/interactions/interactions_set_restrictions_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Interactions_set_restrictions_for_repoHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Interaction_limit // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Interactions_set_restrictions_for_repoHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/interaction-limits%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/interaction-limits", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Interactions_set_restrictions_for_repoHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Interaction_limit_response if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_add_assignees.go b/MCP/go/tools/issues/issues_add_assignees.go index e262fd5..f50032e 100644 --- a/MCP/go/tools/issues/issues_add_assignees.go +++ b/MCP/go/tools/issues/issues_add_assignees.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_add_assigneesHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_add_assigneesHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/assignees%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/assignees", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_add_labels.go b/MCP/go/tools/issues/issues_add_labels.go index 4895688..ee0399a 100644 --- a/MCP/go/tools/issues/issues_add_labels.go +++ b/MCP/go/tools/issues/issues_add_labels.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_add_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Issues_add_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Issues_add_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Label + var result []models.Label if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_add_sub_issue.go b/MCP/go/tools/issues/issues_add_sub_issue.go index 5035d06..27141f7 100644 --- a/MCP/go/tools/issues/issues_add_sub_issue.go +++ b/MCP/go/tools/issues/issues_add_sub_issue.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_add_sub_issueHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_add_sub_issueHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/sub_issues%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/sub_issues", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,13 +112,13 @@ func Issues_add_sub_issueHandler(cfg *config.APIConfig) func(ctx context.Context } func CreateIssues_add_sub_issueTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_issues_issue_number_sub_issues", + tool := mcp.NewTool("post_repos_owner_repo_issues_issue_number_sub", mcp.WithDescription("Add sub-issue"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("issue_number", mcp.Required(), mcp.Description("The number that identifies the issue.")), - mcp.WithBoolean("replace_parent", mcp.Description("Input parameter: Option that, when true, instructs the operation to replace the sub-issues current parent issue")), mcp.WithNumber("sub_issue_id", mcp.Required(), mcp.Description("Input parameter: The id of the sub-issue to add. The sub-issue must belong to the same repository owner as the parent issue")), + mcp.WithBoolean("replace_parent", mcp.Description("Input parameter: Option that, when true, instructs the operation to replace the sub-issues current parent issue")), ) return models.Tool{ diff --git a/MCP/go/tools/issues/issues_check_user_can_be_assigned.go b/MCP/go/tools/issues/issues_check_user_can_be_assigned.go index 30756f7..652fa6e 100644 --- a/MCP/go/tools/issues/issues_check_user_can_be_assigned.go +++ b/MCP/go/tools/issues/issues_check_user_can_be_assigned.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_check_user_can_be_assignedHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: assignee"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/assignees/%s%s", cfg.BaseURL, owner, repo, assignee, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/assignees/%s", cfg.BaseURL, owner, repo, assignee) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_check_user_can_be_assigned_to_issue.go b/MCP/go/tools/issues/issues_check_user_can_be_assigned_to_issue.go index 98501a8..54e9c26 100644 --- a/MCP/go/tools/issues/issues_check_user_can_be_assigned_to_issue.go +++ b/MCP/go/tools/issues/issues_check_user_can_be_assigned_to_issue.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Issues_check_user_can_be_assigned_to_issueHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: assignee"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/assignees/%s%s", cfg.BaseURL, owner, repo, issue_number, assignee, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/assignees/%s", cfg.BaseURL, owner, repo, issue_number, assignee) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_create.go b/MCP/go/tools/issues/issues_create.go index 3ea0f27..3528bed 100644 --- a/MCP/go/tools/issues/issues_create.go +++ b/MCP/go/tools/issues/issues_create.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Issues_createHandler(cfg *config.APIConfig) func(ctx context.Context, reque if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Issues_createHandler(cfg *config.APIConfig) func(ctx context.Context, reque if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,13 +108,13 @@ func CreateIssues_createTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create an issue"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("body", mcp.Description("Input parameter: The contents of the issue.")), - mcp.WithArray("labels", mcp.Description("Input parameter: Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._")), - mcp.WithString("milestone", mcp.Description("")), mcp.WithString("title", mcp.Required(), mcp.Description("Input parameter: The title of the issue.")), mcp.WithString("type", mcp.Description("Input parameter: The name of the issue type to associate with this issue. _NOTE: Only users with push access can set the type for new issues. The type is silently dropped otherwise._")), mcp.WithString("assignee", mcp.Description("Input parameter: Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. **This field is closing down.**_")), mcp.WithArray("assignees", mcp.Description("Input parameter: Logins for Users to assign to this issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._")), + mcp.WithString("body", mcp.Description("Input parameter: The contents of the issue.")), + mcp.WithArray("labels", mcp.Description("Input parameter: Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._")), + mcp.WithString("milestone", mcp.Description("")), ) return models.Tool{ diff --git a/MCP/go/tools/issues/issues_create_comment.go b/MCP/go/tools/issues/issues_create_comment.go index d47e791..e318b91 100644 --- a/MCP/go/tools/issues/issues_create_comment.go +++ b/MCP/go/tools/issues/issues_create_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_create_commentHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_create_commentHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/comments%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/comments", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Issues_create_commentHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Issue_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_create_label.go b/MCP/go/tools/issues/issues_create_label.go index 9a760be..c991a52 100644 --- a/MCP/go/tools/issues/issues_create_label.go +++ b/MCP/go/tools/issues/issues_create_label.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Issues_create_labelHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Issues_create_labelHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/labels%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/labels", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_create_milestone.go b/MCP/go/tools/issues/issues_create_milestone.go index a96376f..b74dec0 100644 --- a/MCP/go/tools/issues/issues_create_milestone.go +++ b/MCP/go/tools/issues/issues_create_milestone.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Issues_create_milestoneHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Issues_create_milestoneHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/milestones%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/milestones", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,10 +108,10 @@ func CreateIssues_create_milestoneTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a milestone"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("description", mcp.Description("Input parameter: A description of the milestone.")), mcp.WithString("due_on", mcp.Description("Input parameter: The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), mcp.WithString("state", mcp.Description("Input parameter: The state of the milestone. Either `open` or `closed`.")), mcp.WithString("title", mcp.Required(), mcp.Description("Input parameter: The title of the milestone.")), - mcp.WithString("description", mcp.Description("Input parameter: A description of the milestone.")), ) return models.Tool{ diff --git a/MCP/go/tools/issues/issues_delete_comment.go b/MCP/go/tools/issues/issues_delete_comment.go index f23ffc6..3eb7508 100644 --- a/MCP/go/tools/issues/issues_delete_comment.go +++ b/MCP/go/tools/issues/issues_delete_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_delete_commentHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_delete_label.go b/MCP/go/tools/issues/issues_delete_label.go index bac8761..889f568 100644 --- a/MCP/go/tools/issues/issues_delete_label.go +++ b/MCP/go/tools/issues/issues_delete_label.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_delete_labelHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/labels/%s%s", cfg.BaseURL, owner, repo, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/labels/%s", cfg.BaseURL, owner, repo, name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_delete_milestone.go b/MCP/go/tools/issues/issues_delete_milestone.go index 4a927de..e5b69a5 100644 --- a/MCP/go/tools/issues/issues_delete_milestone.go +++ b/MCP/go/tools/issues/issues_delete_milestone.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_delete_milestoneHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: milestone_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/milestones/%s%s", cfg.BaseURL, owner, repo, milestone_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/milestones/%s", cfg.BaseURL, owner, repo, milestone_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_get.go b/MCP/go/tools/issues/issues_get.go index 4b1bce3..f873162 100644 --- a/MCP/go/tools/issues/issues_get.go +++ b/MCP/go/tools/issues/issues_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_getHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_get_comment.go b/MCP/go/tools/issues/issues_get_comment.go index f81ffe3..917ab49 100644 --- a/MCP/go/tools/issues/issues_get_comment.go +++ b/MCP/go/tools/issues/issues_get_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_get_commentHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Issues_get_commentHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Issue_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_get_event.go b/MCP/go/tools/issues/issues_get_event.go index db7c9fa..9fbcc5b 100644 --- a/MCP/go/tools/issues/issues_get_event.go +++ b/MCP/go/tools/issues/issues_get_event.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_get_eventHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: event_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/events/%s%s", cfg.BaseURL, owner, repo, event_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/events/%s", cfg.BaseURL, owner, repo, event_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Issues_get_eventHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Issue_event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_get_label.go b/MCP/go/tools/issues/issues_get_label.go index 1c94002..f0dff72 100644 --- a/MCP/go/tools/issues/issues_get_label.go +++ b/MCP/go/tools/issues/issues_get_label.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_get_labelHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/labels/%s%s", cfg.BaseURL, owner, repo, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/labels/%s", cfg.BaseURL, owner, repo, name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_get_milestone.go b/MCP/go/tools/issues/issues_get_milestone.go index 7f51888..ef7e0b3 100644 --- a/MCP/go/tools/issues/issues_get_milestone.go +++ b/MCP/go/tools/issues/issues_get_milestone.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_get_milestoneHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: milestone_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/milestones/%s%s", cfg.BaseURL, owner, repo, milestone_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/milestones/%s", cfg.BaseURL, owner, repo, milestone_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_list.go b/MCP/go/tools/issues/issues_list.go index cd263ac..275a461 100644 --- a/MCP/go/tools/issues/issues_list.go +++ b/MCP/go/tools/issues/issues_list.go @@ -56,34 +56,6 @@ func Issues_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -93,17 +65,20 @@ func Issues_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -121,7 +96,7 @@ func Issues_listHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Issue + var result []models.Issue if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_assignees.go b/MCP/go/tools/issues/issues_list_assignees.go index a2b52f5..88fdda5 100644 --- a/MCP/go/tools/issues/issues_list_assignees.go +++ b/MCP/go/tools/issues/issues_list_assignees.go @@ -42,34 +42,6 @@ func Issues_list_assigneesHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Issues_list_assigneesHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Issues_list_assigneesHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_comments.go b/MCP/go/tools/issues/issues_list_comments.go index ae84db0..06d356b 100644 --- a/MCP/go/tools/issues/issues_list_comments.go +++ b/MCP/go/tools/issues/issues_list_comments.go @@ -53,34 +53,6 @@ func Issues_list_commentsHandler(cfg *config.APIConfig) func(ctx context.Context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Issues_list_commentsHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Issues_list_commentsHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Issue_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_comments_for_repo.go b/MCP/go/tools/issues/issues_list_comments_for_repo.go index ffe7eff..a61f39e 100644 --- a/MCP/go/tools/issues/issues_list_comments_for_repo.go +++ b/MCP/go/tools/issues/issues_list_comments_for_repo.go @@ -51,34 +51,6 @@ func Issues_list_comments_for_repoHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -88,17 +60,20 @@ func Issues_list_comments_for_repoHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -116,7 +91,7 @@ func Issues_list_comments_for_repoHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Issue_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_events.go b/MCP/go/tools/issues/issues_list_events.go index 3afcb68..d019519 100644 --- a/MCP/go/tools/issues/issues_list_events.go +++ b/MCP/go/tools/issues/issues_list_events.go @@ -50,34 +50,6 @@ func Issues_list_eventsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Issues_list_eventsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_list_events_for_repo.go b/MCP/go/tools/issues/issues_list_events_for_repo.go index 674a844..12d9c5e 100644 --- a/MCP/go/tools/issues/issues_list_events_for_repo.go +++ b/MCP/go/tools/issues/issues_list_events_for_repo.go @@ -42,34 +42,6 @@ func Issues_list_events_for_repoHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Issues_list_events_for_repoHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Issues_list_events_for_repoHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Issue_event if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_events_for_timeline.go b/MCP/go/tools/issues/issues_list_events_for_timeline.go index 41b74b6..7bd9ecf 100644 --- a/MCP/go/tools/issues/issues_list_events_for_timeline.go +++ b/MCP/go/tools/issues/issues_list_events_for_timeline.go @@ -50,34 +50,6 @@ func Issues_list_events_for_timelineHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Issues_list_events_for_timelineHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Issues_list_events_for_timelineHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Timeline_issue_events if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_for_authenticated_user.go b/MCP/go/tools/issues/issues_list_for_authenticated_user.go index 415d197..b46edc3 100644 --- a/MCP/go/tools/issues/issues_list_for_authenticated_user.go +++ b/MCP/go/tools/issues/issues_list_for_authenticated_user.go @@ -44,34 +44,6 @@ func Issues_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -81,17 +53,20 @@ func Issues_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +84,7 @@ func Issues_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Issue + var result []models.Issue if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_for_org.go b/MCP/go/tools/issues/issues_list_for_org.go index 0c67c27..5345701 100644 --- a/MCP/go/tools/issues/issues_list_for_org.go +++ b/MCP/go/tools/issues/issues_list_for_org.go @@ -55,34 +55,6 @@ func Issues_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -92,17 +64,20 @@ func Issues_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -120,7 +95,7 @@ func Issues_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Issue + var result []models.Issue if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_for_repo.go b/MCP/go/tools/issues/issues_list_for_repo.go index 5959493..003258d 100644 --- a/MCP/go/tools/issues/issues_list_for_repo.go +++ b/MCP/go/tools/issues/issues_list_for_repo.go @@ -72,34 +72,6 @@ func Issues_list_for_repoHandler(cfg *config.APIConfig) func(ctx context.Context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -109,17 +81,20 @@ func Issues_list_for_repoHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -137,7 +112,7 @@ func Issues_list_for_repoHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Issue + var result []models.Issue if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_labels_for_milestone.go b/MCP/go/tools/issues/issues_list_labels_for_milestone.go index fe3561e..052d057 100644 --- a/MCP/go/tools/issues/issues_list_labels_for_milestone.go +++ b/MCP/go/tools/issues/issues_list_labels_for_milestone.go @@ -50,34 +50,6 @@ func Issues_list_labels_for_milestoneHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Issues_list_labels_for_milestoneHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Issues_list_labels_for_milestoneHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Label + var result []models.Label if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_labels_for_repo.go b/MCP/go/tools/issues/issues_list_labels_for_repo.go index fc7c5a6..741b016 100644 --- a/MCP/go/tools/issues/issues_list_labels_for_repo.go +++ b/MCP/go/tools/issues/issues_list_labels_for_repo.go @@ -42,34 +42,6 @@ func Issues_list_labels_for_repoHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Issues_list_labels_for_repoHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Issues_list_labels_for_repoHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Label + var result []models.Label if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_labels_on_issue.go b/MCP/go/tools/issues/issues_list_labels_on_issue.go index 203f38e..6e51b1c 100644 --- a/MCP/go/tools/issues/issues_list_labels_on_issue.go +++ b/MCP/go/tools/issues/issues_list_labels_on_issue.go @@ -50,34 +50,6 @@ func Issues_list_labels_on_issueHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Issues_list_labels_on_issueHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Issues_list_labels_on_issueHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Label + var result []models.Label if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_milestones.go b/MCP/go/tools/issues/issues_list_milestones.go index c6d7932..2b92e2e 100644 --- a/MCP/go/tools/issues/issues_list_milestones.go +++ b/MCP/go/tools/issues/issues_list_milestones.go @@ -51,34 +51,6 @@ func Issues_list_milestonesHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -88,17 +60,20 @@ func Issues_list_milestonesHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -116,7 +91,7 @@ func Issues_list_milestonesHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Milestone + var result []models.Milestone if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_list_sub_issues.go b/MCP/go/tools/issues/issues_list_sub_issues.go index cb9c071..d62b50e 100644 --- a/MCP/go/tools/issues/issues_list_sub_issues.go +++ b/MCP/go/tools/issues/issues_list_sub_issues.go @@ -50,34 +50,6 @@ func Issues_list_sub_issuesHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Issues_list_sub_issuesHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Issues_list_sub_issuesHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Issue + var result []models.Issue if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -131,7 +106,7 @@ func Issues_list_sub_issuesHandler(cfg *config.APIConfig) func(ctx context.Conte } func CreateIssues_list_sub_issuesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_issues_issue_number_sub_issues", + tool := mcp.NewTool("get_repos_owner_repo_issues_issue_number_sub", mcp.WithDescription("List sub-issues"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/issues/issues_lock.go b/MCP/go/tools/issues/issues_lock.go index 7ef085d..c9e6020 100644 --- a/MCP/go/tools/issues/issues_lock.go +++ b/MCP/go/tools/issues/issues_lock.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_lockHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_lockHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/lock%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/lock", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_remove_all_labels.go b/MCP/go/tools/issues/issues_remove_all_labels.go index d32d00a..9297c45 100644 --- a/MCP/go/tools/issues/issues_remove_all_labels.go +++ b/MCP/go/tools/issues/issues_remove_all_labels.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_remove_all_labelsHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_remove_assignees.go b/MCP/go/tools/issues/issues_remove_assignees.go index 0fa851f..af5951d 100644 --- a/MCP/go/tools/issues/issues_remove_assignees.go +++ b/MCP/go/tools/issues/issues_remove_assignees.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_remove_assigneesHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_remove_assigneesHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/assignees%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/assignees", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_remove_label.go b/MCP/go/tools/issues/issues_remove_label.go index 4f7b723..b3095b0 100644 --- a/MCP/go/tools/issues/issues_remove_label.go +++ b/MCP/go/tools/issues/issues_remove_label.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Issues_remove_labelHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels/%s%s", cfg.BaseURL, owner, repo, issue_number, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels/%s", cfg.BaseURL, owner, repo, issue_number, name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Issues_remove_labelHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Label + var result []models.Label if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_remove_sub_issue.go b/MCP/go/tools/issues/issues_remove_sub_issue.go index 9412fb4..da7b279 100644 --- a/MCP/go/tools/issues/issues_remove_sub_issue.go +++ b/MCP/go/tools/issues/issues_remove_sub_issue.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_remove_sub_issueHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_remove_sub_issueHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/sub_issue%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/sub_issue", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Issues_remove_sub_issueHandler(cfg *config.APIConfig) func(ctx context.Cont } func CreateIssues_remove_sub_issueTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_issues_issue_number_sub_issue", + tool := mcp.NewTool("delete_repos_owner_repo_issues_issue_number_sub", mcp.WithDescription("Remove sub-issue"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/issues/issues_reprioritize_sub_issue.go b/MCP/go/tools/issues/issues_reprioritize_sub_issue.go index d0c28dd..e1794a6 100644 --- a/MCP/go/tools/issues/issues_reprioritize_sub_issue.go +++ b/MCP/go/tools/issues/issues_reprioritize_sub_issue.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_reprioritize_sub_issueHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_reprioritize_sub_issueHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/sub_issues/priority%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/sub_issues/priority", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,14 +112,14 @@ func Issues_reprioritize_sub_issueHandler(cfg *config.APIConfig) func(ctx contex } func CreateIssues_reprioritize_sub_issueTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_repos_owner_repo_issues_issue_number_sub_issues_priority", + tool := mcp.NewTool("patch_repos_owner_repo_issues_issue_number_sub_priority", mcp.WithDescription("Reprioritize sub-issue"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("issue_number", mcp.Required(), mcp.Description("The number that identifies the issue.")), - mcp.WithNumber("after_id", mcp.Description("Input parameter: The id of the sub-issue to be prioritized after (either positional argument after OR before should be specified).")), mcp.WithNumber("before_id", mcp.Description("Input parameter: The id of the sub-issue to be prioritized before (either positional argument after OR before should be specified).")), mcp.WithNumber("sub_issue_id", mcp.Required(), mcp.Description("Input parameter: The id of the sub-issue to reprioritize")), + mcp.WithNumber("after_id", mcp.Description("Input parameter: The id of the sub-issue to be prioritized after (either positional argument after OR before should be specified).")), ) return models.Tool{ diff --git a/MCP/go/tools/issues/issues_set_labels.go b/MCP/go/tools/issues/issues_set_labels.go index b43e9a4..7421801 100644 --- a/MCP/go/tools/issues/issues_set_labels.go +++ b/MCP/go/tools/issues/issues_set_labels.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_set_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Issues_set_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/labels", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Issues_set_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Label + var result []models.Label if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_unlock.go b/MCP/go/tools/issues/issues_unlock.go index 58bc52f..9f03e01 100644 --- a/MCP/go/tools/issues/issues_unlock.go +++ b/MCP/go/tools/issues/issues_unlock.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Issues_unlockHandler(cfg *config.APIConfig) func(ctx context.Context, reque if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/lock%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/lock", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_update.go b/MCP/go/tools/issues/issues_update.go index 12757ab..a8e9537 100644 --- a/MCP/go/tools/issues/issues_update.go +++ b/MCP/go/tools/issues/issues_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reque if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reque if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -149,14 +118,14 @@ func CreateIssues_updateTool(cfg *config.APIConfig) models.Tool { mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("issue_number", mcp.Required(), mcp.Description("The number that identifies the issue.")), mcp.WithArray("labels", mcp.Description("Input parameter: Labels to associate with this issue. Pass one or more labels to _replace_ the set of labels on this issue. Send an empty array (`[]`) to clear all labels from the issue. Only users with push access can set labels for issues. Without push access to the repository, label changes are silently dropped.")), - mcp.WithString("state", mcp.Description("Input parameter: The open or closed state of the issue.")), mcp.WithString("state_reason", mcp.Description("Input parameter: The reason for the state change. Ignored unless `state` is changed.")), mcp.WithString("title", mcp.Description("Input parameter: The title of the issue.")), mcp.WithString("type", mcp.Description("Input parameter: The name of the issue type to associate with this issue or use `null` to remove the current issue type. Only users with push access can set the type for issues. Without push access to the repository, type changes are silently dropped.")), - mcp.WithString("body", mcp.Description("Input parameter: The contents of the issue.")), mcp.WithString("milestone", mcp.Description("")), mcp.WithString("assignee", mcp.Description("Input parameter: Username to assign to this issue. **This field is closing down.**")), mcp.WithArray("assignees", mcp.Description("Input parameter: Usernames to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this issue. Send an empty array (`[]`) to clear all assignees from the issue. Only users with push access can set assignees for new issues. Without push access to the repository, assignee changes are silently dropped.")), + mcp.WithString("body", mcp.Description("Input parameter: The contents of the issue.")), + mcp.WithString("state", mcp.Description("Input parameter: The open or closed state of the issue.")), ) return models.Tool{ diff --git a/MCP/go/tools/issues/issues_update_comment.go b/MCP/go/tools/issues/issues_update_comment.go index 7d01503..2b731e4 100644 --- a/MCP/go/tools/issues/issues_update_comment.go +++ b/MCP/go/tools/issues/issues_update_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_update_commentHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_update_commentHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Issues_update_commentHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Issue_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/issues/issues_update_label.go b/MCP/go/tools/issues/issues_update_label.go index a9903f2..f1c998e 100644 --- a/MCP/go/tools/issues/issues_update_label.go +++ b/MCP/go/tools/issues/issues_update_label.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_update_labelHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_update_labelHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/labels/%s%s", cfg.BaseURL, owner, repo, name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/labels/%s", cfg.BaseURL, owner, repo, name) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/issues/issues_update_milestone.go b/MCP/go/tools/issues/issues_update_milestone.go index da88501..c20f918 100644 --- a/MCP/go/tools/issues/issues_update_milestone.go +++ b/MCP/go/tools/issues/issues_update_milestone.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Issues_update_milestoneHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: milestone_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Issues_update_milestoneHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/milestones/%s%s", cfg.BaseURL, owner, repo, milestone_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/milestones/%s", cfg.BaseURL, owner, repo, milestone_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -148,10 +117,10 @@ func CreateIssues_update_milestoneTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("milestone_number", mcp.Required(), mcp.Description("The number that identifies the milestone.")), - mcp.WithString("due_on", mcp.Description("Input parameter: The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), mcp.WithString("state", mcp.Description("Input parameter: The state of the milestone. Either `open` or `closed`.")), mcp.WithString("title", mcp.Description("Input parameter: The title of the milestone.")), mcp.WithString("description", mcp.Description("Input parameter: A description of the milestone.")), + mcp.WithString("due_on", mcp.Description("Input parameter: The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), ) return models.Tool{ diff --git a/MCP/go/tools/licenses/licenses_get.go b/MCP/go/tools/licenses/licenses_get.go index 0b4c500..609e51f 100644 --- a/MCP/go/tools/licenses/licenses_get.go +++ b/MCP/go/tools/licenses/licenses_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Licenses_getHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: license"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/licenses/%s%s", cfg.BaseURL, license, queryString) + url := fmt.Sprintf("%s/licenses/%s", cfg.BaseURL, license) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/licenses/licenses_get_all_commonly_used.go b/MCP/go/tools/licenses/licenses_get_all_commonly_used.go index 2d31e50..84181c6 100644 --- a/MCP/go/tools/licenses/licenses_get_all_commonly_used.go +++ b/MCP/go/tools/licenses/licenses_get_all_commonly_used.go @@ -29,34 +29,6 @@ func Licenses_get_all_commonly_usedHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Licenses_get_all_commonly_usedHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -94,7 +69,7 @@ func Licenses_get_all_commonly_usedHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_License_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/licenses/licenses_get_for_repo.go b/MCP/go/tools/licenses/licenses_get_for_repo.go index c561f75..b6ebced 100644 --- a/MCP/go/tools/licenses/licenses_get_for_repo.go +++ b/MCP/go/tools/licenses/licenses_get_for_repo.go @@ -39,34 +39,6 @@ func Licenses_get_for_repoHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Licenses_get_for_repoHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -104,7 +79,7 @@ func Licenses_get_for_repoHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_License_content if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/meta/meta_get.go b/MCP/go/tools/meta/meta_get.go index 1416877..2df2925 100644 --- a/MCP/go/tools/meta/meta_get.go +++ b/MCP/go/tools/meta/meta_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Meta_getHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/meta%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/meta", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -81,7 +50,7 @@ func Meta_getHandler(cfg *config.APIConfig) func(ctx context.Context, request mc return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Api_overview if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/meta/meta_get_all_versions.go b/MCP/go/tools/meta/meta_get_all_versions.go index 6ed3b3f..d91a0d3 100644 --- a/MCP/go/tools/meta/meta_get_all_versions.go +++ b/MCP/go/tools/meta/meta_get_all_versions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Meta_get_all_versionsHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/versions%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/versions", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/meta/meta_get_zen.go b/MCP/go/tools/meta/meta_get_zen.go index d2d6c70..0b75c34 100644 --- a/MCP/go/tools/meta/meta_get_zen.go +++ b/MCP/go/tools/meta/meta_get_zen.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Meta_get_zenHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/zen%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/zen", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/meta/meta_root.go b/MCP/go/tools/meta/meta_root.go index 36d2ff6..4477e74 100644 --- a/MCP/go/tools/meta/meta_root.go +++ b/MCP/go/tools/meta/meta_root.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Meta_rootHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_cancel_import.go b/MCP/go/tools/migrations/migrations_cancel_import.go index f46df3a..dd81260 100644 --- a/MCP/go/tools/migrations/migrations_cancel_import.go +++ b/MCP/go/tools/migrations/migrations_cancel_import.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Migrations_cancel_importHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/import%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_delete_archive_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_delete_archive_for_authenticated_user.go index b15d5f9..712ae0f 100644 --- a/MCP/go/tools/migrations/migrations_delete_archive_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_delete_archive_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Migrations_delete_archive_for_authenticated_userHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: migration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/migrations/%s/archive%s", cfg.BaseURL, migration_id, queryString) + url := fmt.Sprintf("%s/user/migrations/%s/archive", cfg.BaseURL, migration_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_delete_archive_for_org.go b/MCP/go/tools/migrations/migrations_delete_archive_for_org.go index 64819bb..a655dfa 100644 --- a/MCP/go/tools/migrations/migrations_delete_archive_for_org.go +++ b/MCP/go/tools/migrations/migrations_delete_archive_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Migrations_delete_archive_for_orgHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: migration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/migrations/%s/archive%s", cfg.BaseURL, org, migration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/migrations/%s/archive", cfg.BaseURL, org, migration_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_download_archive_for_org.go b/MCP/go/tools/migrations/migrations_download_archive_for_org.go index 4c02e6e..bd9ab86 100644 --- a/MCP/go/tools/migrations/migrations_download_archive_for_org.go +++ b/MCP/go/tools/migrations/migrations_download_archive_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Migrations_download_archive_for_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: migration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/migrations/%s/archive%s", cfg.BaseURL, org, migration_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/migrations/%s/archive", cfg.BaseURL, org, migration_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_get_archive_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_get_archive_for_authenticated_user.go index 2c66442..55df638 100644 --- a/MCP/go/tools/migrations/migrations_get_archive_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_get_archive_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Migrations_get_archive_for_authenticated_userHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: migration_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/migrations/%s/archive%s", cfg.BaseURL, migration_id, queryString) + url := fmt.Sprintf("%s/user/migrations/%s/archive", cfg.BaseURL, migration_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_get_commit_authors.go b/MCP/go/tools/migrations/migrations_get_commit_authors.go index 51deeac..849b50e 100644 --- a/MCP/go/tools/migrations/migrations_get_commit_authors.go +++ b/MCP/go/tools/migrations/migrations_get_commit_authors.go @@ -39,34 +39,6 @@ func Migrations_get_commit_authorsHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["since"]; ok { queryParams = append(queryParams, fmt.Sprintf("since=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Migrations_get_commit_authorsHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -104,7 +79,7 @@ func Migrations_get_commit_authorsHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Porter_author if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_get_import_status.go b/MCP/go/tools/migrations/migrations_get_import_status.go index a93c989..0f97f62 100644 --- a/MCP/go/tools/migrations/migrations_get_import_status.go +++ b/MCP/go/tools/migrations/migrations_get_import_status.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Migrations_get_import_statusHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/import%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_get_large_files.go b/MCP/go/tools/migrations/migrations_get_large_files.go index 64631a6..ad93850 100644 --- a/MCP/go/tools/migrations/migrations_get_large_files.go +++ b/MCP/go/tools/migrations/migrations_get_large_files.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Migrations_get_large_filesHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/import/large_files%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import/large_files", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Migrations_get_large_filesHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Porter_large_file if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_get_status_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_get_status_for_authenticated_user.go index 9654453..1aa3866 100644 --- a/MCP/go/tools/migrations/migrations_get_status_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_get_status_for_authenticated_user.go @@ -31,34 +31,6 @@ func Migrations_get_status_for_authenticated_userHandler(cfg *config.APIConfig) if val, ok := args["exclude"]; ok { queryParams = append(queryParams, fmt.Sprintf("exclude=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -68,17 +40,20 @@ func Migrations_get_status_for_authenticated_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_get_status_for_org.go b/MCP/go/tools/migrations/migrations_get_status_for_org.go index c3ca442..f80b0eb 100644 --- a/MCP/go/tools/migrations/migrations_get_status_for_org.go +++ b/MCP/go/tools/migrations/migrations_get_status_for_org.go @@ -39,34 +39,6 @@ func Migrations_get_status_for_orgHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["exclude"]; ok { queryParams = append(queryParams, fmt.Sprintf("exclude=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Migrations_get_status_for_orgHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_list_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_list_for_authenticated_user.go index fbca401..c760f85 100644 --- a/MCP/go/tools/migrations/migrations_list_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_list_for_authenticated_user.go @@ -26,34 +26,6 @@ func Migrations_list_for_authenticated_userHandler(cfg *config.APIConfig) func(c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Migrations_list_for_authenticated_userHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Migrations_list_for_authenticated_userHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Migration + var result []models.Migration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_list_for_org.go b/MCP/go/tools/migrations/migrations_list_for_org.go index f7cee24..0ce1b1d 100644 --- a/MCP/go/tools/migrations/migrations_list_for_org.go +++ b/MCP/go/tools/migrations/migrations_list_for_org.go @@ -37,34 +37,6 @@ func Migrations_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["exclude"]; ok { queryParams = append(queryParams, fmt.Sprintf("exclude=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Migrations_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Migrations_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Migration + var result []models.Migration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_list_repos_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_list_repos_for_authenticated_user.go index e75e49f..2d70397 100644 --- a/MCP/go/tools/migrations/migrations_list_repos_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_list_repos_for_authenticated_user.go @@ -34,34 +34,6 @@ func Migrations_list_repos_for_authenticated_userHandler(cfg *config.APIConfig) if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Migrations_list_repos_for_authenticated_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Migrations_list_repos_for_authenticated_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_list_repos_for_org.go b/MCP/go/tools/migrations/migrations_list_repos_for_org.go index 62d3647..4d926b8 100644 --- a/MCP/go/tools/migrations/migrations_list_repos_for_org.go +++ b/MCP/go/tools/migrations/migrations_list_repos_for_org.go @@ -42,34 +42,6 @@ func Migrations_list_repos_for_orgHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Migrations_list_repos_for_orgHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Migrations_list_repos_for_orgHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_map_commit_author.go b/MCP/go/tools/migrations/migrations_map_commit_author.go index 7ca2375..587093b 100644 --- a/MCP/go/tools/migrations/migrations_map_commit_author.go +++ b/MCP/go/tools/migrations/migrations_map_commit_author.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Migrations_map_commit_authorHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: author_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Migrations_map_commit_authorHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/import/authors/%s%s", cfg.BaseURL, owner, repo, author_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import/authors/%s", cfg.BaseURL, owner, repo, author_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Migrations_map_commit_authorHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Porter_author if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/migrations/migrations_set_lfs_preference.go b/MCP/go/tools/migrations/migrations_set_lfs_preference.go index 50ff220..1e730fc 100644 --- a/MCP/go/tools/migrations/migrations_set_lfs_preference.go +++ b/MCP/go/tools/migrations/migrations_set_lfs_preference.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Migrations_set_lfs_preferenceHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Migrations_set_lfs_preferenceHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/import/lfs%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import/lfs", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_start_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_start_for_authenticated_user.go index cbd51a9..ba2adfa 100644 --- a/MCP/go/tools/migrations/migrations_start_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_start_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Migrations_start_for_authenticated_userHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Migrations_start_for_authenticated_userHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/migrations%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/migrations", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -121,15 +90,15 @@ func Migrations_start_for_authenticated_userHandler(cfg *config.APIConfig) func( func CreateMigrations_start_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_user_migrations", mcp.WithDescription("Start a user migration"), - mcp.WithBoolean("org_metadata_only", mcp.Description("Input parameter: Indicates whether this should only include organization metadata (repositories array should be empty and will ignore other flags).")), mcp.WithArray("exclude", mcp.Description("Input parameter: Exclude attributes from the API response to improve performance")), - mcp.WithBoolean("exclude_metadata", mcp.Description("Input parameter: Indicates whether metadata should be excluded and only git source should be included for the migration.")), + mcp.WithBoolean("exclude_releases", mcp.Description("Input parameter: Do not include releases in the migration")), mcp.WithArray("repositories", mcp.Required(), mcp.Description("")), + mcp.WithBoolean("exclude_git_data", mcp.Description("Input parameter: Indicates whether the repository git data should be excluded from the migration.")), + mcp.WithBoolean("lock_repositories", mcp.Description("Input parameter: Lock the repositories being migrated at the start of the migration")), + mcp.WithBoolean("org_metadata_only", mcp.Description("Input parameter: Indicates whether this should only include organization metadata (repositories array should be empty and will ignore other flags).")), mcp.WithBoolean("exclude_attachments", mcp.Description("Input parameter: Do not include attachments in the migration")), + mcp.WithBoolean("exclude_metadata", mcp.Description("Input parameter: Indicates whether metadata should be excluded and only git source should be included for the migration.")), mcp.WithBoolean("exclude_owner_projects", mcp.Description("Input parameter: Indicates whether projects owned by the organization or users should be excluded.")), - mcp.WithBoolean("lock_repositories", mcp.Description("Input parameter: Lock the repositories being migrated at the start of the migration")), - mcp.WithBoolean("exclude_git_data", mcp.Description("Input parameter: Indicates whether the repository git data should be excluded from the migration.")), - mcp.WithBoolean("exclude_releases", mcp.Description("Input parameter: Do not include releases in the migration")), ) return models.Tool{ diff --git a/MCP/go/tools/migrations/migrations_start_for_org.go b/MCP/go/tools/migrations/migrations_start_for_org.go index 533de98..4406753 100644 --- a/MCP/go/tools/migrations/migrations_start_for_org.go +++ b/MCP/go/tools/migrations/migrations_start_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Migrations_start_for_orgHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Migrations_start_for_orgHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/migrations%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/migrations", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -131,14 +100,14 @@ func CreateMigrations_start_for_orgTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Start an organization migration"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithBoolean("org_metadata_only", mcp.Description("Input parameter: Indicates whether this should only include organization metadata (repositories array should be empty and will ignore other flags).")), - mcp.WithBoolean("exclude_releases", mcp.Description("Input parameter: Indicates whether releases should be excluded from the migration (to reduce migration archive file size).")), - mcp.WithBoolean("lock_repositories", mcp.Description("Input parameter: Indicates whether repositories should be locked (to prevent manipulation) while migrating data.")), - mcp.WithArray("repositories", mcp.Required(), mcp.Description("Input parameter: A list of arrays indicating which repositories should be migrated.")), mcp.WithArray("exclude", mcp.Description("Input parameter: Exclude related items from being returned in the response in order to improve performance of the request.")), - mcp.WithBoolean("exclude_attachments", mcp.Description("Input parameter: Indicates whether attachments should be excluded from the migration (to reduce migration archive file size).")), mcp.WithBoolean("exclude_git_data", mcp.Description("Input parameter: Indicates whether the repository git data should be excluded from the migration.")), - mcp.WithBoolean("exclude_metadata", mcp.Description("Input parameter: Indicates whether metadata should be excluded and only git source should be included for the migration.")), mcp.WithBoolean("exclude_owner_projects", mcp.Description("Input parameter: Indicates whether projects owned by the organization or users should be excluded. from the migration.")), + mcp.WithBoolean("exclude_attachments", mcp.Description("Input parameter: Indicates whether attachments should be excluded from the migration (to reduce migration archive file size).")), + mcp.WithBoolean("exclude_releases", mcp.Description("Input parameter: Indicates whether releases should be excluded from the migration (to reduce migration archive file size).")), + mcp.WithArray("repositories", mcp.Required(), mcp.Description("Input parameter: A list of arrays indicating which repositories should be migrated.")), + mcp.WithBoolean("exclude_metadata", mcp.Description("Input parameter: Indicates whether metadata should be excluded and only git source should be included for the migration.")), + mcp.WithBoolean("lock_repositories", mcp.Description("Input parameter: Indicates whether repositories should be locked (to prevent manipulation) while migrating data.")), ) return models.Tool{ diff --git a/MCP/go/tools/migrations/migrations_start_import.go b/MCP/go/tools/migrations/migrations_start_import.go index a644fcd..52c3029 100644 --- a/MCP/go/tools/migrations/migrations_start_import.go +++ b/MCP/go/tools/migrations/migrations_start_import.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Migrations_start_importHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Migrations_start_importHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/import%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,11 +108,11 @@ func CreateMigrations_start_importTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Start an import"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("tfvc_project", mcp.Description("Input parameter: For a tfvc import, the name of the project that is being imported.")), - mcp.WithString("vcs", mcp.Description("Input parameter: The originating VCS type. Without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response.")), mcp.WithString("vcs_password", mcp.Description("Input parameter: If authentication is required, the password to provide to `vcs_url`.")), mcp.WithString("vcs_url", mcp.Required(), mcp.Description("Input parameter: The URL of the originating repository.")), mcp.WithString("vcs_username", mcp.Description("Input parameter: If authentication is required, the username to provide to `vcs_url`.")), + mcp.WithString("tfvc_project", mcp.Description("Input parameter: For a tfvc import, the name of the project that is being imported.")), + mcp.WithString("vcs", mcp.Description("Input parameter: The originating VCS type. Without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response.")), ) return models.Tool{ diff --git a/MCP/go/tools/migrations/migrations_unlock_repo_for_authenticated_user.go b/MCP/go/tools/migrations/migrations_unlock_repo_for_authenticated_user.go index 7608e1d..1c2906b 100644 --- a/MCP/go/tools/migrations/migrations_unlock_repo_for_authenticated_user.go +++ b/MCP/go/tools/migrations/migrations_unlock_repo_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Migrations_unlock_repo_for_authenticated_userHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: repo_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/migrations/%s/repos/%s/lock%s", cfg.BaseURL, migration_id, repo_name, queryString) + url := fmt.Sprintf("%s/user/migrations/%s/repos/%s/lock", cfg.BaseURL, migration_id, repo_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_unlock_repo_for_org.go b/MCP/go/tools/migrations/migrations_unlock_repo_for_org.go index 7f92e38..57205ca 100644 --- a/MCP/go/tools/migrations/migrations_unlock_repo_for_org.go +++ b/MCP/go/tools/migrations/migrations_unlock_repo_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Migrations_unlock_repo_for_orgHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: repo_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/migrations/%s/repos/%s/lock%s", cfg.BaseURL, org, migration_id, repo_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/migrations/%s/repos/%s/lock", cfg.BaseURL, org, migration_id, repo_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/migrations/migrations_update_import.go b/MCP/go/tools/migrations/migrations_update_import.go index 2f4e736..21f9ca5 100644 --- a/MCP/go/tools/migrations/migrations_update_import.go +++ b/MCP/go/tools/migrations/migrations_update_import.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Migrations_update_importHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Migrations_update_importHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/import%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/import", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,10 +108,10 @@ func CreateMigrations_update_importTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update an import"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("tfvc_project", mcp.Description("Input parameter: For a tfvc import, the name of the project that is being imported.")), mcp.WithString("vcs", mcp.Description("Input parameter: The type of version control system you are migrating from.")), mcp.WithString("vcs_password", mcp.Description("Input parameter: The password to provide to the originating repository.")), mcp.WithString("vcs_username", mcp.Description("Input parameter: The username to provide to the originating repository.")), - mcp.WithString("tfvc_project", mcp.Description("Input parameter: For a tfvc import, the name of the project that is being imported.")), ) return models.Tool{ diff --git a/MCP/go/tools/oidc/oidc_get_oidc_custom_sub_template_for_org.go b/MCP/go/tools/oidc/oidc_get_oidc_custom_sub_template_for_org.go index fcc85ff..b3d3519 100644 --- a/MCP/go/tools/oidc/oidc_get_oidc_custom_sub_template_for_org.go +++ b/MCP/go/tools/oidc/oidc_get_oidc_custom_sub_template_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Oidc_get_oidc_custom_sub_template_for_orgHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/actions/oidc/customization/sub%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/oidc/customization/sub", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Oidc_get_oidc_custom_sub_template_for_orgHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Oidc_custom_sub if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/oidc/oidc_update_oidc_custom_sub_template_for_org.go b/MCP/go/tools/oidc/oidc_update_oidc_custom_sub_template_for_org.go index 79606db..fed3c57 100644 --- a/MCP/go/tools/oidc/oidc_update_oidc_custom_sub_template_for_org.go +++ b/MCP/go/tools/oidc/oidc_update_oidc_custom_sub_template_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,41 +27,8 @@ func Oidc_update_oidc_custom_sub_template_for_orgHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Oidc_custom_sub // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -77,23 +43,26 @@ func Oidc_update_oidc_custom_sub_template_for_orgHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/actions/oidc/customization/sub%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/actions/oidc/customization/sub", cfg.BaseURL, org) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Oidc_update_oidc_custom_sub_template_for_orgHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Empty_object if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/api_insights_get_route_stats_by_actor.go b/MCP/go/tools/orgs/api_insights_get_route_stats_by_actor.go index 5ebb58b..2f81e14 100644 --- a/MCP/go/tools/orgs/api_insights_get_route_stats_by_actor.go +++ b/MCP/go/tools/orgs/api_insights_get_route_stats_by_actor.go @@ -65,34 +65,6 @@ func Api_insights_get_route_stats_by_actorHandler(cfg *config.APIConfig) func(ct if val, ok := args["api_route_substring"]; ok { queryParams = append(queryParams, fmt.Sprintf("api_route_substring=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -102,17 +74,20 @@ func Api_insights_get_route_stats_by_actorHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -146,7 +121,7 @@ func Api_insights_get_route_stats_by_actorHandler(cfg *config.APIConfig) func(ct } func CreateApi_insights_get_route_stats_by_actorTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_insights_api_route-stats_actor_type_actor_id", + tool := mcp.NewTool("get_orgs_org_insights_api_route-stats_actor_type_id", mcp.WithDescription("Get route stats by actor"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("actor_type", mcp.Required(), mcp.Description("The type of the actor")), diff --git a/MCP/go/tools/orgs/api_insights_get_subject_stats.go b/MCP/go/tools/orgs/api_insights_get_subject_stats.go index e807310..4af42e1 100644 --- a/MCP/go/tools/orgs/api_insights_get_subject_stats.go +++ b/MCP/go/tools/orgs/api_insights_get_subject_stats.go @@ -49,34 +49,6 @@ func Api_insights_get_subject_statsHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["subject_name_substring"]; ok { queryParams = append(queryParams, fmt.Sprintf("subject_name_substring=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -86,17 +58,20 @@ func Api_insights_get_subject_statsHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/api_insights_get_summary_stats.go b/MCP/go/tools/orgs/api_insights_get_summary_stats.go index 38c6e06..80a1f7c 100644 --- a/MCP/go/tools/orgs/api_insights_get_summary_stats.go +++ b/MCP/go/tools/orgs/api_insights_get_summary_stats.go @@ -34,34 +34,6 @@ func Api_insights_get_summary_statsHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["max_timestamp"]; ok { queryParams = append(queryParams, fmt.Sprintf("max_timestamp=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Api_insights_get_summary_statsHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Api_insights_get_summary_statsHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Api_insights_summary_stats if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/api_insights_get_summary_stats_by_actor.go b/MCP/go/tools/orgs/api_insights_get_summary_stats_by_actor.go index f5d1ae4..d7ad2bf 100644 --- a/MCP/go/tools/orgs/api_insights_get_summary_stats_by_actor.go +++ b/MCP/go/tools/orgs/api_insights_get_summary_stats_by_actor.go @@ -50,34 +50,6 @@ func Api_insights_get_summary_stats_by_actorHandler(cfg *config.APIConfig) func( if val, ok := args["max_timestamp"]; ok { queryParams = append(queryParams, fmt.Sprintf("max_timestamp=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Api_insights_get_summary_stats_by_actorHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Api_insights_get_summary_stats_by_actorHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Api_insights_summary_stats if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -131,7 +106,7 @@ func Api_insights_get_summary_stats_by_actorHandler(cfg *config.APIConfig) func( } func CreateApi_insights_get_summary_stats_by_actorTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_insights_api_summary-stats_actor_type_actor_id", + tool := mcp.NewTool("get_orgs_org_insights_api_summary-stats_actor_type_id", mcp.WithDescription("Get summary stats by actor"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("min_timestamp", mcp.Required(), mcp.Description("The minimum timestamp to query for stats. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.")), diff --git a/MCP/go/tools/orgs/api_insights_get_summary_stats_by_user.go b/MCP/go/tools/orgs/api_insights_get_summary_stats_by_user.go index 4697d33..5302482 100644 --- a/MCP/go/tools/orgs/api_insights_get_summary_stats_by_user.go +++ b/MCP/go/tools/orgs/api_insights_get_summary_stats_by_user.go @@ -42,34 +42,6 @@ func Api_insights_get_summary_stats_by_userHandler(cfg *config.APIConfig) func(c if val, ok := args["max_timestamp"]; ok { queryParams = append(queryParams, fmt.Sprintf("max_timestamp=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Api_insights_get_summary_stats_by_userHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Api_insights_get_summary_stats_by_userHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Api_insights_summary_stats if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/api_insights_get_time_stats.go b/MCP/go/tools/orgs/api_insights_get_time_stats.go index 26ece70..41d4a24 100644 --- a/MCP/go/tools/orgs/api_insights_get_time_stats.go +++ b/MCP/go/tools/orgs/api_insights_get_time_stats.go @@ -37,34 +37,6 @@ func Api_insights_get_time_statsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["timestamp_increment"]; ok { queryParams = append(queryParams, fmt.Sprintf("timestamp_increment=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Api_insights_get_time_statsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/api_insights_get_time_stats_by_actor.go b/MCP/go/tools/orgs/api_insights_get_time_stats_by_actor.go index 9303bac..5d66441 100644 --- a/MCP/go/tools/orgs/api_insights_get_time_stats_by_actor.go +++ b/MCP/go/tools/orgs/api_insights_get_time_stats_by_actor.go @@ -53,34 +53,6 @@ func Api_insights_get_time_stats_by_actorHandler(cfg *config.APIConfig) func(ctx if val, ok := args["timestamp_increment"]; ok { queryParams = append(queryParams, fmt.Sprintf("timestamp_increment=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Api_insights_get_time_stats_by_actorHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -134,7 +109,7 @@ func Api_insights_get_time_stats_by_actorHandler(cfg *config.APIConfig) func(ctx } func CreateApi_insights_get_time_stats_by_actorTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_insights_api_time-stats_actor_type_actor_id", + tool := mcp.NewTool("get_orgs_org_insights_api_time-stats_actor_type_id", mcp.WithDescription("Get time stats by actor"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("actor_type", mcp.Required(), mcp.Description("The type of the actor")), diff --git a/MCP/go/tools/orgs/api_insights_get_time_stats_by_user.go b/MCP/go/tools/orgs/api_insights_get_time_stats_by_user.go index d44d5fc..5040bd7 100644 --- a/MCP/go/tools/orgs/api_insights_get_time_stats_by_user.go +++ b/MCP/go/tools/orgs/api_insights_get_time_stats_by_user.go @@ -45,34 +45,6 @@ func Api_insights_get_time_stats_by_userHandler(cfg *config.APIConfig) func(ctx if val, ok := args["timestamp_increment"]; ok { queryParams = append(queryParams, fmt.Sprintf("timestamp_increment=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Api_insights_get_time_stats_by_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/api_insights_get_user_stats.go b/MCP/go/tools/orgs/api_insights_get_user_stats.go index 4adb2fe..f66c308 100644 --- a/MCP/go/tools/orgs/api_insights_get_user_stats.go +++ b/MCP/go/tools/orgs/api_insights_get_user_stats.go @@ -57,34 +57,6 @@ func Api_insights_get_user_statsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["actor_name_substring"]; ok { queryParams = append(queryParams, fmt.Sprintf("actor_name_substring=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -94,17 +66,20 @@ func Api_insights_get_user_statsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_add_security_manager_team.go b/MCP/go/tools/orgs/orgs_add_security_manager_team.go index 873233f..7ce7a69 100644 --- a/MCP/go/tools/orgs/orgs_add_security_manager_team.go +++ b/MCP/go/tools/orgs/orgs_add_security_manager_team.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_add_security_manager_teamHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/security-managers/teams/%s%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/security-managers/teams/%s", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_assign_team_to_org_role.go b/MCP/go/tools/orgs/orgs_assign_team_to_org_role.go index 7fcdfdc..780701b 100644 --- a/MCP/go/tools/orgs/orgs_assign_team_to_org_role.go +++ b/MCP/go/tools/orgs/orgs_assign_team_to_org_role.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_assign_team_to_org_roleHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: role_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/teams/%s/%s%s", cfg.BaseURL, org, team_slug, role_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/teams/%s/%s", cfg.BaseURL, org, team_slug, role_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_assign_user_to_org_role.go b/MCP/go/tools/orgs/orgs_assign_user_to_org_role.go index 4be04a2..beee78d 100644 --- a/MCP/go/tools/orgs/orgs_assign_user_to_org_role.go +++ b/MCP/go/tools/orgs/orgs_assign_user_to_org_role.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_assign_user_to_org_roleHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: role_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/users/%s/%s%s", cfg.BaseURL, org, username, role_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/users/%s/%s", cfg.BaseURL, org, username, role_id) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_block_user.go b/MCP/go/tools/orgs/orgs_block_user.go index 043e758..47aef4d 100644 --- a/MCP/go/tools/orgs/orgs_block_user.go +++ b/MCP/go/tools/orgs/orgs_block_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_block_userHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/blocks/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/blocks/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_cancel_invitation.go b/MCP/go/tools/orgs/orgs_cancel_invitation.go index 4941a65..39881a1 100644 --- a/MCP/go/tools/orgs/orgs_cancel_invitation.go +++ b/MCP/go/tools/orgs/orgs_cancel_invitation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_cancel_invitationHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: invitation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/invitations/%s%s", cfg.BaseURL, org, invitation_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/invitations/%s", cfg.BaseURL, org, invitation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_check_blocked_user.go b/MCP/go/tools/orgs/orgs_check_blocked_user.go index c49c2cc..273e65c 100644 --- a/MCP/go/tools/orgs/orgs_check_blocked_user.go +++ b/MCP/go/tools/orgs/orgs_check_blocked_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_check_blocked_userHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/blocks/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/blocks/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_check_membership_for_user.go b/MCP/go/tools/orgs/orgs_check_membership_for_user.go index a6347db..802e8d4 100644 --- a/MCP/go/tools/orgs/orgs_check_membership_for_user.go +++ b/MCP/go/tools/orgs/orgs_check_membership_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_check_membership_for_userHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/members/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/members/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_check_public_membership_for_user.go b/MCP/go/tools/orgs/orgs_check_public_membership_for_user.go index 0f88ac8..dd0ba9b 100644 --- a/MCP/go/tools/orgs/orgs_check_public_membership_for_user.go +++ b/MCP/go/tools/orgs/orgs_check_public_membership_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_check_public_membership_for_userHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/public_members/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/public_members/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_convert_member_to_outside_collaborator.go b/MCP/go/tools/orgs/orgs_convert_member_to_outside_collaborator.go index f795aaa..193b72b 100644 --- a/MCP/go/tools/orgs/orgs_convert_member_to_outside_collaborator.go +++ b/MCP/go/tools/orgs/orgs_convert_member_to_outside_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Orgs_convert_member_to_outside_collaboratorHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Orgs_convert_member_to_outside_collaboratorHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/outside_collaborators/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/outside_collaborators/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_create_invitation.go b/MCP/go/tools/orgs/orgs_create_invitation.go index 3b9f4f8..d9e08c4 100644 --- a/MCP/go/tools/orgs/orgs_create_invitation.go +++ b/MCP/go/tools/orgs/orgs_create_invitation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_create_invitationHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_create_invitationHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/invitations%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/invitations", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Orgs_create_invitationHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,10 +99,10 @@ func CreateOrgs_create_invitationTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_orgs_org_invitations", mcp.WithDescription("Create an organization invitation"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("email", mcp.Description("Input parameter: **Required unless you provide `invitee_id`**. Email address of the person you are inviting, which can be an existing GitHub user.")), mcp.WithNumber("invitee_id", mcp.Description("Input parameter: **Required unless you provide `email`**. GitHub user ID for the person you are inviting.")), mcp.WithString("role", mcp.Description("Input parameter: The role for the new member. \n * `admin` - Organization owners with full administrative rights to the organization and complete access to all repositories and teams. \n * `direct_member` - Non-owner organization members with ability to see other members and join teams by invitation. \n * `billing_manager` - Non-owner organization members with ability to manage the billing settings of your organization. \n * `reinstate` - The previous role assigned to the invitee before they were removed from your organization. Can be one of the roles listed above. Only works if the invitee was previously part of your organization.")), mcp.WithArray("team_ids", mcp.Description("Input parameter: Specify IDs for the teams you want to invite new members to.")), + mcp.WithString("email", mcp.Description("Input parameter: **Required unless you provide `invitee_id`**. Email address of the person you are inviting, which can be an existing GitHub user.")), ) return models.Tool{ diff --git a/MCP/go/tools/orgs/orgs_create_issue_type.go b/MCP/go/tools/orgs/orgs_create_issue_type.go index 97d8a48..0dd0f19 100644 --- a/MCP/go/tools/orgs/orgs_create_issue_type.go +++ b/MCP/go/tools/orgs/orgs_create_issue_type.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,41 +27,8 @@ func Orgs_create_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Organization_create_issue_type // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -77,23 +43,26 @@ func Orgs_create_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/issue-types%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/issue-types", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Orgs_create_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Issue_type if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_create_or_update_custom_properties.go b/MCP/go/tools/orgs/orgs_create_or_update_custom_properties.go index 1149d29..e380b64 100644 --- a/MCP/go/tools/orgs/orgs_create_or_update_custom_properties.go +++ b/MCP/go/tools/orgs/orgs_create_or_update_custom_properties.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_create_or_update_custom_propertiesHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_create_or_update_custom_propertiesHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/properties/schema%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/properties/schema", cfg.BaseURL, org) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Orgs_create_or_update_custom_propertiesHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Custom_property if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_create_or_update_custom_properties_values_for_repos.go b/MCP/go/tools/orgs/orgs_create_or_update_custom_properties_values_for_repos.go index 8d668fd..f6b6382 100644 --- a/MCP/go/tools/orgs/orgs_create_or_update_custom_properties_values_for_repos.go +++ b/MCP/go/tools/orgs/orgs_create_or_update_custom_properties_values_for_repos.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_create_or_update_custom_properties_values_for_reposHandler(cfg *config if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_create_or_update_custom_properties_values_for_reposHandler(cfg *config if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/properties/values%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/properties/values", cfg.BaseURL, org) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_create_or_update_custom_property.go b/MCP/go/tools/orgs/orgs_create_or_update_custom_property.go index af84a9c..cfe7ebd 100644 --- a/MCP/go/tools/orgs/orgs_create_or_update_custom_property.go +++ b/MCP/go/tools/orgs/orgs_create_or_update_custom_property.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Orgs_create_or_update_custom_propertyHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: custom_property_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Custom_property_set_payload // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Orgs_create_or_update_custom_propertyHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/properties/schema/%s%s", cfg.BaseURL, org, custom_property_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/properties/schema/%s", cfg.BaseURL, org, custom_property_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Orgs_create_or_update_custom_propertyHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Custom_property if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,12 +108,12 @@ func CreateOrgs_create_or_update_custom_propertyTool(cfg *config.APIConfig) mode mcp.WithDescription("Create or update a custom property for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("custom_property_name", mcp.Required(), mcp.Description("The custom property name")), + mcp.WithArray("allowed_values", mcp.Description("Input parameter: An ordered list of the allowed values of the property.\nThe property can have up to 200 allowed values.")), + mcp.WithString("default_value", mcp.Description("Input parameter: Default value of the property")), mcp.WithString("description", mcp.Description("Input parameter: Short description of the property")), mcp.WithBoolean("required", mcp.Description("Input parameter: Whether the property is required.")), mcp.WithString("value_type", mcp.Required(), mcp.Description("Input parameter: The type of the value for the property")), mcp.WithString("values_editable_by", mcp.Description("Input parameter: Who can edit the values of the property")), - mcp.WithArray("allowed_values", mcp.Description("Input parameter: An ordered list of the allowed values of the property.\nThe property can have up to 200 allowed values.")), - mcp.WithString("default_value", mcp.Description("Input parameter: Default value of the property")), ) return models.Tool{ diff --git a/MCP/go/tools/orgs/orgs_create_webhook.go b/MCP/go/tools/orgs/orgs_create_webhook.go index 0f32ee6..f864a0f 100644 --- a/MCP/go/tools/orgs/orgs_create_webhook.go +++ b/MCP/go/tools/orgs/orgs_create_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_create_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_create_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/hooks%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Orgs_create_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_hook if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_delete.go b/MCP/go/tools/orgs/orgs_delete.go index 956a83e..fef233b 100644 --- a/MCP/go/tools/orgs/orgs_delete.go +++ b/MCP/go/tools/orgs/orgs_delete.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_deleteHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s", cfg.BaseURL, org) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_delete_attestations_bulk.go b/MCP/go/tools/orgs/orgs_delete_attestations_bulk.go index 309c05c..3bb1f72 100644 --- a/MCP/go/tools/orgs/orgs_delete_attestations_bulk.go +++ b/MCP/go/tools/orgs/orgs_delete_attestations_bulk.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_delete_attestations_bulkHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -77,23 +43,26 @@ func Orgs_delete_attestations_bulkHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/attestations/delete-request%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/attestations/delete-request", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_delete_attestations_by_id.go b/MCP/go/tools/orgs/orgs_delete_attestations_by_id.go index 6070dba..378df8a 100644 --- a/MCP/go/tools/orgs/orgs_delete_attestations_by_id.go +++ b/MCP/go/tools/orgs/orgs_delete_attestations_by_id.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_delete_attestations_by_idHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: attestation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/attestations/%s%s", cfg.BaseURL, org, attestation_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/attestations/%s", cfg.BaseURL, org, attestation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_delete_attestations_by_subject_digest.go b/MCP/go/tools/orgs/orgs_delete_attestations_by_subject_digest.go index 57997c1..a7e2060 100644 --- a/MCP/go/tools/orgs/orgs_delete_attestations_by_subject_digest.go +++ b/MCP/go/tools/orgs/orgs_delete_attestations_by_subject_digest.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_delete_attestations_by_subject_digestHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: subject_digest"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/attestations/digest/%s%s", cfg.BaseURL, org, subject_digest, queryString) + url := fmt.Sprintf("%s/orgs/%s/attestations/digest/%s", cfg.BaseURL, org, subject_digest) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Orgs_delete_attestations_by_subject_digestHandler(cfg *config.APIConfig) fu } func CreateOrgs_delete_attestations_by_subject_digestTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_attestations_digest_subject_digest", + tool := mcp.NewTool("delete_orgs_org_attestations_digest_subject", mcp.WithDescription("Delete attestations by subject digest"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("subject_digest", mcp.Required(), mcp.Description("Subject Digest")), diff --git a/MCP/go/tools/orgs/orgs_delete_issue_type.go b/MCP/go/tools/orgs/orgs_delete_issue_type.go index 98259ca..d56a4a1 100644 --- a/MCP/go/tools/orgs/orgs_delete_issue_type.go +++ b/MCP/go/tools/orgs/orgs_delete_issue_type.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_delete_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_type_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/issue-types/%s%s", cfg.BaseURL, org, issue_type_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/issue-types/%s", cfg.BaseURL, org, issue_type_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_delete_webhook.go b/MCP/go/tools/orgs/orgs_delete_webhook.go index e8c5353..f867768 100644 --- a/MCP/go/tools/orgs/orgs_delete_webhook.go +++ b/MCP/go/tools/orgs/orgs_delete_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_delete_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s%s", cfg.BaseURL, org, hook_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s", cfg.BaseURL, org, hook_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_enable_or_disable_security_product_on_all_org_repos.go b/MCP/go/tools/orgs/orgs_enable_or_disable_security_product_on_all_org_repos.go index b834e61..b46271d 100644 --- a/MCP/go/tools/orgs/orgs_enable_or_disable_security_product_on_all_org_repos.go +++ b/MCP/go/tools/orgs/orgs_enable_or_disable_security_product_on_all_org_repos.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Orgs_enable_or_disable_security_product_on_all_org_reposHandler(cfg *config if !ok { return mcp.NewToolResultError("Invalid path parameter: enablement"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Orgs_enable_or_disable_security_product_on_all_org_reposHandler(cfg *config if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/%s/%s%s", cfg.BaseURL, org, security_product, enablement, queryString) + url := fmt.Sprintf("%s/orgs/%s/%s/%s", cfg.BaseURL, org, security_product, enablement) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_get.go b/MCP/go/tools/orgs/orgs_get.go index 63ffb48..d7d197d 100644 --- a/MCP/go/tools/orgs/orgs_get.go +++ b/MCP/go/tools/orgs/orgs_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_getHandler(cfg *config.APIConfig) func(ctx context.Context, request mc if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Orgs_getHandler(cfg *config.APIConfig) func(ctx context.Context, request mc return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_all_custom_properties.go b/MCP/go/tools/orgs/orgs_get_all_custom_properties.go index 6d2adb0..ab81779 100644 --- a/MCP/go/tools/orgs/orgs_get_all_custom_properties.go +++ b/MCP/go/tools/orgs/orgs_get_all_custom_properties.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_get_all_custom_propertiesHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/properties/schema%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/properties/schema", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Orgs_get_all_custom_propertiesHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Custom_property if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_custom_property.go b/MCP/go/tools/orgs/orgs_get_custom_property.go index a1e7ddc..1371b52 100644 --- a/MCP/go/tools/orgs/orgs_get_custom_property.go +++ b/MCP/go/tools/orgs/orgs_get_custom_property.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_get_custom_propertyHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: custom_property_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/properties/schema/%s%s", cfg.BaseURL, org, custom_property_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/properties/schema/%s", cfg.BaseURL, org, custom_property_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Orgs_get_custom_propertyHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Custom_property if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_membership_for_authenticated_user.go b/MCP/go/tools/orgs/orgs_get_membership_for_authenticated_user.go index 99d565d..713de85 100644 --- a/MCP/go/tools/orgs/orgs_get_membership_for_authenticated_user.go +++ b/MCP/go/tools/orgs/orgs_get_membership_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_get_membership_for_authenticated_userHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/memberships/orgs/%s%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/user/memberships/orgs/%s", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Orgs_get_membership_for_authenticated_userHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_membership_for_user.go b/MCP/go/tools/orgs/orgs_get_membership_for_user.go index dfe2e2c..482ac57 100644 --- a/MCP/go/tools/orgs/orgs_get_membership_for_user.go +++ b/MCP/go/tools/orgs/orgs_get_membership_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_get_membership_for_userHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/memberships/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/memberships/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Orgs_get_membership_for_userHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_org_role.go b/MCP/go/tools/orgs/orgs_get_org_role.go index 65cb124..0f83b06 100644 --- a/MCP/go/tools/orgs/orgs_get_org_role.go +++ b/MCP/go/tools/orgs/orgs_get_org_role.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_get_org_roleHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: role_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/%s%s", cfg.BaseURL, org, role_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/%s", cfg.BaseURL, org, role_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Orgs_get_org_roleHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_role if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_org_ruleset_history.go b/MCP/go/tools/orgs/orgs_get_org_ruleset_history.go index 2bdaaae..22953d8 100644 --- a/MCP/go/tools/orgs/orgs_get_org_ruleset_history.go +++ b/MCP/go/tools/orgs/orgs_get_org_ruleset_history.go @@ -42,34 +42,6 @@ func Orgs_get_org_ruleset_historyHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_get_org_ruleset_historyHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_get_org_ruleset_historyHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Ruleset_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_org_ruleset_version.go b/MCP/go/tools/orgs/orgs_get_org_ruleset_version.go index 4d36184..a6f0fc8 100644 --- a/MCP/go/tools/orgs/orgs_get_org_ruleset_version.go +++ b/MCP/go/tools/orgs/orgs_get_org_ruleset_version.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_get_org_ruleset_versionHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/rulesets/%s/history/%s%s", cfg.BaseURL, org, ruleset_id, version_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/rulesets/%s/history/%s", cfg.BaseURL, org, ruleset_id, version_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Orgs_get_org_ruleset_versionHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Ruleset_version_with_state if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Orgs_get_org_ruleset_versionHandler(cfg *config.APIConfig) func(ctx context } func CreateOrgs_get_org_ruleset_versionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_rulesets_ruleset_id_history_version_id", + tool := mcp.NewTool("get_orgs_org_rulesets_ruleset_id_history_version", mcp.WithDescription("Get organization ruleset version"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("ruleset_id", mcp.Required(), mcp.Description("The ID of the ruleset.")), diff --git a/MCP/go/tools/orgs/orgs_get_webhook.go b/MCP/go/tools/orgs/orgs_get_webhook.go index 0816187..c4cac1f 100644 --- a/MCP/go/tools/orgs/orgs_get_webhook.go +++ b/MCP/go/tools/orgs/orgs_get_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_get_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s%s", cfg.BaseURL, org, hook_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s", cfg.BaseURL, org, hook_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Orgs_get_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_hook if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_webhook_config_for_org.go b/MCP/go/tools/orgs/orgs_get_webhook_config_for_org.go index 0e023be..a886347 100644 --- a/MCP/go/tools/orgs/orgs_get_webhook_config_for_org.go +++ b/MCP/go/tools/orgs/orgs_get_webhook_config_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_get_webhook_config_for_orgHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s/config%s", cfg.BaseURL, org, hook_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s/config", cfg.BaseURL, org, hook_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Orgs_get_webhook_config_for_orgHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Webhook_config if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_get_webhook_delivery.go b/MCP/go/tools/orgs/orgs_get_webhook_delivery.go index 1c56292..ffbe6a1 100644 --- a/MCP/go/tools/orgs/orgs_get_webhook_delivery.go +++ b/MCP/go/tools/orgs/orgs_get_webhook_delivery.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: delivery_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s/deliveries/%s%s", cfg.BaseURL, org, hook_id, delivery_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s/deliveries/%s", cfg.BaseURL, org, hook_id, delivery_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Orgs_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Hook_delivery if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Orgs_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.Co } func CreateOrgs_get_webhook_deliveryTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_hooks_hook_id_deliveries_delivery_id", + tool := mcp.NewTool("get_orgs_org_hooks_hook_id_deliveries_delivery", mcp.WithDescription("Get a webhook delivery for an organization webhook"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("hook_id", mcp.Required(), mcp.Description("The unique identifier of the hook. You can find this value in the `X-GitHub-Hook-ID` header of a webhook delivery.")), diff --git a/MCP/go/tools/orgs/orgs_list.go b/MCP/go/tools/orgs/orgs_list.go index f061145..9b413d6 100644 --- a/MCP/go/tools/orgs/orgs_list.go +++ b/MCP/go/tools/orgs/orgs_list.go @@ -26,34 +26,6 @@ func Orgs_listHandler(cfg *config.APIConfig) func(ctx context.Context, request m if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Orgs_listHandler(cfg *config.APIConfig) func(ctx context.Context, request m if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Orgs_listHandler(cfg *config.APIConfig) func(ctx context.Context, request m return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_app_installations.go b/MCP/go/tools/orgs/orgs_list_app_installations.go index 06699e4..4538721 100644 --- a/MCP/go/tools/orgs/orgs_list_app_installations.go +++ b/MCP/go/tools/orgs/orgs_list_app_installations.go @@ -34,34 +34,6 @@ func Orgs_list_app_installationsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Orgs_list_app_installationsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_list_attestations.go b/MCP/go/tools/orgs/orgs_list_attestations.go index a296c62..ecf7a9e 100644 --- a/MCP/go/tools/orgs/orgs_list_attestations.go +++ b/MCP/go/tools/orgs/orgs_list_attestations.go @@ -48,34 +48,6 @@ func Orgs_list_attestationsHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["predicate_type"]; ok { queryParams = append(queryParams, fmt.Sprintf("predicate_type=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Orgs_list_attestationsHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_list_attestations_bulk.go b/MCP/go/tools/orgs/orgs_list_attestations_bulk.go index ea7bac9..a0b65b7 100644 --- a/MCP/go/tools/orgs/orgs_list_attestations_bulk.go +++ b/MCP/go/tools/orgs/orgs_list_attestations_bulk.go @@ -38,34 +38,6 @@ func Orgs_list_attestations_bulkHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["after"]; ok { queryParams = append(queryParams, fmt.Sprintf("after=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -92,17 +64,20 @@ func Orgs_list_attestations_bulkHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_list_blocked_users.go b/MCP/go/tools/orgs/orgs_list_blocked_users.go index 9cf70fd..834b953 100644 --- a/MCP/go/tools/orgs/orgs_list_blocked_users.go +++ b/MCP/go/tools/orgs/orgs_list_blocked_users.go @@ -34,34 +34,6 @@ func Orgs_list_blocked_usersHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Orgs_list_blocked_usersHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Orgs_list_blocked_usersHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_custom_properties_values_for_repos.go b/MCP/go/tools/orgs/orgs_list_custom_properties_values_for_repos.go index c7ce67f..26e10f3 100644 --- a/MCP/go/tools/orgs/orgs_list_custom_properties_values_for_repos.go +++ b/MCP/go/tools/orgs/orgs_list_custom_properties_values_for_repos.go @@ -37,34 +37,6 @@ func Orgs_list_custom_properties_values_for_reposHandler(cfg *config.APIConfig) if val, ok := args["repository_query"]; ok { queryParams = append(queryParams, fmt.Sprintf("repository_query=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Orgs_list_custom_properties_values_for_reposHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Orgs_list_custom_properties_values_for_reposHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Org_repo_custom_property_values if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_failed_invitations.go b/MCP/go/tools/orgs/orgs_list_failed_invitations.go index e7ffcf0..ee35032 100644 --- a/MCP/go/tools/orgs/orgs_list_failed_invitations.go +++ b/MCP/go/tools/orgs/orgs_list_failed_invitations.go @@ -34,34 +34,6 @@ func Orgs_list_failed_invitationsHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Orgs_list_failed_invitationsHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Orgs_list_failed_invitationsHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_for_authenticated_user.go b/MCP/go/tools/orgs/orgs_list_for_authenticated_user.go index 89d2f86..a93d8b9 100644 --- a/MCP/go/tools/orgs/orgs_list_for_authenticated_user.go +++ b/MCP/go/tools/orgs/orgs_list_for_authenticated_user.go @@ -26,34 +26,6 @@ func Orgs_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Orgs_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Orgs_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_for_user.go b/MCP/go/tools/orgs/orgs_list_for_user.go index dae39ec..709abc3 100644 --- a/MCP/go/tools/orgs/orgs_list_for_user.go +++ b/MCP/go/tools/orgs/orgs_list_for_user.go @@ -34,34 +34,6 @@ func Orgs_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Orgs_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Orgs_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_invitation_teams.go b/MCP/go/tools/orgs/orgs_list_invitation_teams.go index 8902e94..e0ee11b 100644 --- a/MCP/go/tools/orgs/orgs_list_invitation_teams.go +++ b/MCP/go/tools/orgs/orgs_list_invitation_teams.go @@ -42,34 +42,6 @@ func Orgs_list_invitation_teamsHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_list_invitation_teamsHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_list_invitation_teamsHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_issue_types.go b/MCP/go/tools/orgs/orgs_list_issue_types.go index e2d4498..627c666 100644 --- a/MCP/go/tools/orgs/orgs_list_issue_types.go +++ b/MCP/go/tools/orgs/orgs_list_issue_types.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_list_issue_typesHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/issue-types%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/issue-types", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Orgs_list_issue_typesHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Issue_type if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_members.go b/MCP/go/tools/orgs/orgs_list_members.go index 6553831..7ca699a 100644 --- a/MCP/go/tools/orgs/orgs_list_members.go +++ b/MCP/go/tools/orgs/orgs_list_members.go @@ -40,34 +40,6 @@ func Orgs_list_membersHandler(cfg *config.APIConfig) func(ctx context.Context, r if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Orgs_list_membersHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Orgs_list_membersHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_memberships_for_authenticated_user.go b/MCP/go/tools/orgs/orgs_list_memberships_for_authenticated_user.go index 972e554..b83589c 100644 --- a/MCP/go/tools/orgs/orgs_list_memberships_for_authenticated_user.go +++ b/MCP/go/tools/orgs/orgs_list_memberships_for_authenticated_user.go @@ -29,34 +29,6 @@ func Orgs_list_memberships_for_authenticated_userHandler(cfg *config.APIConfig) if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Orgs_list_memberships_for_authenticated_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -94,7 +69,7 @@ func Orgs_list_memberships_for_authenticated_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Org_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_org_role_teams.go b/MCP/go/tools/orgs/orgs_list_org_role_teams.go index 816527e..36843b0 100644 --- a/MCP/go/tools/orgs/orgs_list_org_role_teams.go +++ b/MCP/go/tools/orgs/orgs_list_org_role_teams.go @@ -42,34 +42,6 @@ func Orgs_list_org_role_teamsHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_list_org_role_teamsHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_list_org_role_teamsHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_role_assignment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_org_role_users.go b/MCP/go/tools/orgs/orgs_list_org_role_users.go index 2b5f487..8b7e02b 100644 --- a/MCP/go/tools/orgs/orgs_list_org_role_users.go +++ b/MCP/go/tools/orgs/orgs_list_org_role_users.go @@ -42,34 +42,6 @@ func Orgs_list_org_role_usersHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_list_org_role_usersHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_list_org_role_usersHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_User_role_assignment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_org_roles.go b/MCP/go/tools/orgs/orgs_list_org_roles.go index f59b690..244f8c1 100644 --- a/MCP/go/tools/orgs/orgs_list_org_roles.go +++ b/MCP/go/tools/orgs/orgs_list_org_roles.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_list_org_rolesHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_list_outside_collaborators.go b/MCP/go/tools/orgs/orgs_list_outside_collaborators.go index 9363627..e52db62 100644 --- a/MCP/go/tools/orgs/orgs_list_outside_collaborators.go +++ b/MCP/go/tools/orgs/orgs_list_outside_collaborators.go @@ -37,34 +37,6 @@ func Orgs_list_outside_collaboratorsHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Orgs_list_outside_collaboratorsHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Orgs_list_outside_collaboratorsHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_pat_grant_repositories.go b/MCP/go/tools/orgs/orgs_list_pat_grant_repositories.go index dd24896..d86618e 100644 --- a/MCP/go/tools/orgs/orgs_list_pat_grant_repositories.go +++ b/MCP/go/tools/orgs/orgs_list_pat_grant_repositories.go @@ -42,34 +42,6 @@ func Orgs_list_pat_grant_repositoriesHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_list_pat_grant_repositoriesHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_list_pat_grant_repositoriesHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_pat_grant_request_repositories.go b/MCP/go/tools/orgs/orgs_list_pat_grant_request_repositories.go index cefdf8a..8ac522d 100644 --- a/MCP/go/tools/orgs/orgs_list_pat_grant_request_repositories.go +++ b/MCP/go/tools/orgs/orgs_list_pat_grant_request_repositories.go @@ -42,34 +42,6 @@ func Orgs_list_pat_grant_request_repositoriesHandler(cfg *config.APIConfig) func if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_list_pat_grant_request_repositoriesHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_list_pat_grant_request_repositoriesHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -123,7 +98,7 @@ func Orgs_list_pat_grant_request_repositoriesHandler(cfg *config.APIConfig) func } func CreateOrgs_list_pat_grant_request_repositoriesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_personal-access-token-requests_pat_request_id_repositories", + tool := mcp.NewTool("get_orgs_org_personal-access-token-requests_pat_request_id", mcp.WithDescription("List repositories requested to be accessed by a fine-grained personal access token"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("pat_request_id", mcp.Required(), mcp.Description("Unique identifier of the request for access via fine-grained personal access token.")), diff --git a/MCP/go/tools/orgs/orgs_list_pat_grant_requests.go b/MCP/go/tools/orgs/orgs_list_pat_grant_requests.go index ef3f136..6bf8092 100644 --- a/MCP/go/tools/orgs/orgs_list_pat_grant_requests.go +++ b/MCP/go/tools/orgs/orgs_list_pat_grant_requests.go @@ -58,34 +58,6 @@ func Orgs_list_pat_grant_requestsHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["token_id"]; ok { queryParams = append(queryParams, fmt.Sprintf("token_id=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -95,17 +67,20 @@ func Orgs_list_pat_grant_requestsHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -123,7 +98,7 @@ func Orgs_list_pat_grant_requestsHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_programmatic_access_grant_request if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_pat_grants.go b/MCP/go/tools/orgs/orgs_list_pat_grants.go index 0339d7b..761f031 100644 --- a/MCP/go/tools/orgs/orgs_list_pat_grants.go +++ b/MCP/go/tools/orgs/orgs_list_pat_grants.go @@ -58,34 +58,6 @@ func Orgs_list_pat_grantsHandler(cfg *config.APIConfig) func(ctx context.Context if val, ok := args["token_id"]; ok { queryParams = append(queryParams, fmt.Sprintf("token_id=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -95,17 +67,20 @@ func Orgs_list_pat_grantsHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -123,7 +98,7 @@ func Orgs_list_pat_grantsHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_programmatic_access_grant if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_pending_invitations.go b/MCP/go/tools/orgs/orgs_list_pending_invitations.go index 63df884..9855bb0 100644 --- a/MCP/go/tools/orgs/orgs_list_pending_invitations.go +++ b/MCP/go/tools/orgs/orgs_list_pending_invitations.go @@ -40,34 +40,6 @@ func Orgs_list_pending_invitationsHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["invitation_source"]; ok { queryParams = append(queryParams, fmt.Sprintf("invitation_source=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Orgs_list_pending_invitationsHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Orgs_list_pending_invitationsHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_public_members.go b/MCP/go/tools/orgs/orgs_list_public_members.go index aeae9f7..085edc9 100644 --- a/MCP/go/tools/orgs/orgs_list_public_members.go +++ b/MCP/go/tools/orgs/orgs_list_public_members.go @@ -34,34 +34,6 @@ func Orgs_list_public_membersHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Orgs_list_public_membersHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Orgs_list_public_membersHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_security_manager_teams.go b/MCP/go/tools/orgs/orgs_list_security_manager_teams.go index 6985b35..9689e2f 100644 --- a/MCP/go/tools/orgs/orgs_list_security_manager_teams.go +++ b/MCP/go/tools/orgs/orgs_list_security_manager_teams.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Orgs_list_security_manager_teamsHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/security-managers%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/security-managers", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Orgs_list_security_manager_teamsHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_webhook_deliveries.go b/MCP/go/tools/orgs/orgs_list_webhook_deliveries.go index d0419e3..8ebeb7c 100644 --- a/MCP/go/tools/orgs/orgs_list_webhook_deliveries.go +++ b/MCP/go/tools/orgs/orgs_list_webhook_deliveries.go @@ -42,34 +42,6 @@ func Orgs_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["cursor"]; ok { queryParams = append(queryParams, fmt.Sprintf("cursor=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Orgs_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Orgs_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Hook_delivery_item if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_list_webhooks.go b/MCP/go/tools/orgs/orgs_list_webhooks.go index 98cf1d6..6bd57da 100644 --- a/MCP/go/tools/orgs/orgs_list_webhooks.go +++ b/MCP/go/tools/orgs/orgs_list_webhooks.go @@ -34,34 +34,6 @@ func Orgs_list_webhooksHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Orgs_list_webhooksHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Orgs_list_webhooksHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Org_hook if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_ping_webhook.go b/MCP/go/tools/orgs/orgs_ping_webhook.go index 2889de1..f7c432d 100644 --- a/MCP/go/tools/orgs/orgs_ping_webhook.go +++ b/MCP/go/tools/orgs/orgs_ping_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_ping_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s/pings%s", cfg.BaseURL, org, hook_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s/pings", cfg.BaseURL, org, hook_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_redeliver_webhook_delivery.go b/MCP/go/tools/orgs/orgs_redeliver_webhook_delivery.go index 9987c9b..94725b3 100644 --- a/MCP/go/tools/orgs/orgs_redeliver_webhook_delivery.go +++ b/MCP/go/tools/orgs/orgs_redeliver_webhook_delivery.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_redeliver_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: delivery_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s/deliveries/%s/attempts%s", cfg.BaseURL, org, hook_id, delivery_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s/deliveries/%s/attempts", cfg.BaseURL, org, hook_id, delivery_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Orgs_redeliver_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx cont } func CreateOrgs_redeliver_webhook_deliveryTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_hooks_hook_id_deliveries_delivery_id_attempts", + tool := mcp.NewTool("post_orgs_org_hooks_hook_id_deliveries_delivery_attempts", mcp.WithDescription("Redeliver a delivery for an organization webhook"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("hook_id", mcp.Required(), mcp.Description("The unique identifier of the hook. You can find this value in the `X-GitHub-Hook-ID` header of a webhook delivery.")), diff --git a/MCP/go/tools/orgs/orgs_remove_custom_property.go b/MCP/go/tools/orgs/orgs_remove_custom_property.go index 56f33f2..cb5adf0 100644 --- a/MCP/go/tools/orgs/orgs_remove_custom_property.go +++ b/MCP/go/tools/orgs/orgs_remove_custom_property.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_remove_custom_propertyHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: custom_property_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/properties/schema/%s%s", cfg.BaseURL, org, custom_property_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/properties/schema/%s", cfg.BaseURL, org, custom_property_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_remove_member.go b/MCP/go/tools/orgs/orgs_remove_member.go index 6db2dab..9b9cadc 100644 --- a/MCP/go/tools/orgs/orgs_remove_member.go +++ b/MCP/go/tools/orgs/orgs_remove_member.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_remove_memberHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/members/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/members/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_remove_membership_for_user.go b/MCP/go/tools/orgs/orgs_remove_membership_for_user.go index c756380..646e5d0 100644 --- a/MCP/go/tools/orgs/orgs_remove_membership_for_user.go +++ b/MCP/go/tools/orgs/orgs_remove_membership_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_remove_membership_for_userHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/memberships/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/memberships/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_remove_outside_collaborator.go b/MCP/go/tools/orgs/orgs_remove_outside_collaborator.go index 59943ea..96088f6 100644 --- a/MCP/go/tools/orgs/orgs_remove_outside_collaborator.go +++ b/MCP/go/tools/orgs/orgs_remove_outside_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_remove_outside_collaboratorHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/outside_collaborators/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/outside_collaborators/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_remove_public_membership_for_authenticated_user.go b/MCP/go/tools/orgs/orgs_remove_public_membership_for_authenticated_user.go index 185ab93..818e112 100644 --- a/MCP/go/tools/orgs/orgs_remove_public_membership_for_authenticated_user.go +++ b/MCP/go/tools/orgs/orgs_remove_public_membership_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_remove_public_membership_for_authenticated_userHandler(cfg *config.API if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/public_members/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/public_members/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_remove_security_manager_team.go b/MCP/go/tools/orgs/orgs_remove_security_manager_team.go index f32edc0..202f528 100644 --- a/MCP/go/tools/orgs/orgs_remove_security_manager_team.go +++ b/MCP/go/tools/orgs/orgs_remove_security_manager_team.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_remove_security_manager_teamHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/security-managers/teams/%s%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/security-managers/teams/%s", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_review_pat_grant_request.go b/MCP/go/tools/orgs/orgs_review_pat_grant_request.go index 68c641f..93560f3 100644 --- a/MCP/go/tools/orgs/orgs_review_pat_grant_request.go +++ b/MCP/go/tools/orgs/orgs_review_pat_grant_request.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Orgs_review_pat_grant_requestHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: pat_request_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Orgs_review_pat_grant_requestHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/personal-access-token-requests/%s%s", cfg.BaseURL, org, pat_request_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/personal-access-token-requests/%s", cfg.BaseURL, org, pat_request_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_review_pat_grant_requests_in_bulk.go b/MCP/go/tools/orgs/orgs_review_pat_grant_requests_in_bulk.go index e9966fb..4fcb956 100644 --- a/MCP/go/tools/orgs/orgs_review_pat_grant_requests_in_bulk.go +++ b/MCP/go/tools/orgs/orgs_review_pat_grant_requests_in_bulk.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_review_pat_grant_requests_in_bulkHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_review_pat_grant_requests_in_bulkHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/personal-access-token-requests%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/personal-access-token-requests", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -130,9 +99,9 @@ func CreateOrgs_review_pat_grant_requests_in_bulkTool(cfg *config.APIConfig) mod tool := mcp.NewTool("post_orgs_org_personal-access-token-requests", mcp.WithDescription("Review requests to access organization resources with fine-grained personal access tokens"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), + mcp.WithString("reason", mcp.Description("Input parameter: Reason for approving or denying the requests. Max 1024 characters.")), mcp.WithString("action", mcp.Required(), mcp.Description("Input parameter: Action to apply to the requests.")), mcp.WithArray("pat_request_ids", mcp.Description("Input parameter: Unique identifiers of the requests for access via fine-grained personal access token. Must be formed of between 1 and 100 `pat_request_id` values.")), - mcp.WithString("reason", mcp.Description("Input parameter: Reason for approving or denying the requests. Max 1024 characters.")), ) return models.Tool{ diff --git a/MCP/go/tools/orgs/orgs_revoke_all_org_roles_team.go b/MCP/go/tools/orgs/orgs_revoke_all_org_roles_team.go index 689f913..edaf648 100644 --- a/MCP/go/tools/orgs/orgs_revoke_all_org_roles_team.go +++ b/MCP/go/tools/orgs/orgs_revoke_all_org_roles_team.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_revoke_all_org_roles_teamHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/teams/%s%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/teams/%s", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_revoke_all_org_roles_user.go b/MCP/go/tools/orgs/orgs_revoke_all_org_roles_user.go index 42df01b..617dc2a 100644 --- a/MCP/go/tools/orgs/orgs_revoke_all_org_roles_user.go +++ b/MCP/go/tools/orgs/orgs_revoke_all_org_roles_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_revoke_all_org_roles_userHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/users/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/users/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_revoke_org_role_team.go b/MCP/go/tools/orgs/orgs_revoke_org_role_team.go index 022ddeb..e7697bb 100644 --- a/MCP/go/tools/orgs/orgs_revoke_org_role_team.go +++ b/MCP/go/tools/orgs/orgs_revoke_org_role_team.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_revoke_org_role_teamHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: role_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/teams/%s/%s%s", cfg.BaseURL, org, team_slug, role_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/teams/%s/%s", cfg.BaseURL, org, team_slug, role_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_revoke_org_role_user.go b/MCP/go/tools/orgs/orgs_revoke_org_role_user.go index 9cf77f1..381ac5f 100644 --- a/MCP/go/tools/orgs/orgs_revoke_org_role_user.go +++ b/MCP/go/tools/orgs/orgs_revoke_org_role_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Orgs_revoke_org_role_userHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: role_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/organization-roles/users/%s/%s%s", cfg.BaseURL, org, username, role_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/organization-roles/users/%s/%s", cfg.BaseURL, org, username, role_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_set_membership_for_user.go b/MCP/go/tools/orgs/orgs_set_membership_for_user.go index cbe02a4..cf2e701 100644 --- a/MCP/go/tools/orgs/orgs_set_membership_for_user.go +++ b/MCP/go/tools/orgs/orgs_set_membership_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Orgs_set_membership_for_userHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Orgs_set_membership_for_userHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/memberships/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/memberships/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Orgs_set_membership_for_userHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_set_public_membership_for_authenticated_user.go b/MCP/go/tools/orgs/orgs_set_public_membership_for_authenticated_user.go index e6f8320..71a83c5 100644 --- a/MCP/go/tools/orgs/orgs_set_public_membership_for_authenticated_user.go +++ b/MCP/go/tools/orgs/orgs_set_public_membership_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_set_public_membership_for_authenticated_userHandler(cfg *config.APICon if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/public_members/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/public_members/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_unblock_user.go b/MCP/go/tools/orgs/orgs_unblock_user.go index 4540c95..7ca1ced 100644 --- a/MCP/go/tools/orgs/orgs_unblock_user.go +++ b/MCP/go/tools/orgs/orgs_unblock_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Orgs_unblock_userHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/blocks/%s%s", cfg.BaseURL, org, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/blocks/%s", cfg.BaseURL, org, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_update.go b/MCP/go/tools/orgs/orgs_update.go index fd99888..e7f35d5 100644 --- a/MCP/go/tools/orgs/orgs_update.go +++ b/MCP/go/tools/orgs/orgs_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_updateHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_updateHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s", cfg.BaseURL, org) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Orgs_updateHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Organization_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,36 +99,36 @@ func CreateOrgs_updateTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("patch_orgs_org", mcp.WithDescription("Update an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("default_repository_permission", mcp.Description("Input parameter: Default permission level members have for organization repositories.")), - mcp.WithBoolean("dependabot_security_updates_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), - mcp.WithBoolean("members_can_create_private_pages", mcp.Description("Input parameter: Whether organization members can create private GitHub Pages sites. Existing published sites will not be impacted.")), + mcp.WithBoolean("deploy_keys_enabled_for_repositories", mcp.Description("Input parameter: Controls whether or not deploy keys may be added and used for repositories in the organization.")), + mcp.WithString("billing_email", mcp.Description("Input parameter: Billing email address. This address is not publicized.")), + mcp.WithBoolean("members_can_create_internal_repositories", mcp.Description("Input parameter: Whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see \"[Restricting repository creation in your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)\" in the GitHub Help documentation.")), + mcp.WithBoolean("members_can_create_private_repositories", mcp.Description("Input parameter: Whether organization members can create private repositories, which are visible to organization members with permission. For more information, see \"[Restricting repository creation in your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)\" in the GitHub Help documentation.")), + mcp.WithString("company", mcp.Description("Input parameter: The company name.")), + mcp.WithBoolean("members_can_fork_private_repositories", mcp.Description("Input parameter: Whether organization members can fork private organization repositories.")), mcp.WithString("location", mcp.Description("Input parameter: The location.")), + mcp.WithBoolean("members_can_create_pages", mcp.Description("Input parameter: Whether organization members can create GitHub Pages sites. Existing published sites will not be impacted.")), + mcp.WithBoolean("dependabot_security_updates_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), mcp.WithBoolean("has_organization_projects", mcp.Description("Input parameter: Whether an organization can use organization projects.")), - mcp.WithBoolean("advanced_security_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether GitHub Advanced Security is automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), - mcp.WithBoolean("members_can_create_public_repositories", mcp.Description("Input parameter: Whether organization members can create public repositories, which are visible to anyone. For more information, see \"[Restricting repository creation in your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)\" in the GitHub Help documentation.")), - mcp.WithString("description", mcp.Description("Input parameter: The description of the company. The maximum size is 160 characters.")), mcp.WithBoolean("dependabot_alerts_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether Dependabot alerts are automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), - mcp.WithBoolean("members_can_create_public_pages", mcp.Description("Input parameter: Whether organization members can create public GitHub Pages sites. Existing published sites will not be impacted.")), - mcp.WithBoolean("members_can_create_private_repositories", mcp.Description("Input parameter: Whether organization members can create private repositories, which are visible to organization members with permission. For more information, see \"[Restricting repository creation in your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)\" in the GitHub Help documentation.")), - mcp.WithString("name", mcp.Description("Input parameter: The shorthand name of the company.")), - mcp.WithBoolean("members_can_create_pages", mcp.Description("Input parameter: Whether organization members can create GitHub Pages sites. Existing published sites will not be impacted.")), - mcp.WithBoolean("dependency_graph_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether dependency graph is automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), - mcp.WithBoolean("members_can_fork_private_repositories", mcp.Description("Input parameter: Whether organization members can fork private organization repositories.")), - mcp.WithString("email", mcp.Description("Input parameter: The publicly visible email address.")), - mcp.WithString("members_allowed_repository_creation_type", mcp.Description("Input parameter: Specifies which types of repositories non-admin organization members can create. `private` is only available to repositories that are part of an organization on GitHub Enterprise Cloud. \n**Note:** This parameter is closing down and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in `members_can_create_repositories`. See the parameter deprecation notice in the operation description for details.")), - mcp.WithBoolean("deploy_keys_enabled_for_repositories", mcp.Description("Input parameter: Controls whether or not deploy keys may be added and used for repositories in the organization.")), mcp.WithString("blog", mcp.Description("")), - mcp.WithBoolean("members_can_create_repositories", mcp.Description("Input parameter: Whether of non-admin organization members can create repositories. **Note:** A parameter can override this parameter. See `members_allowed_repository_creation_type` in this table for details.")), + mcp.WithString("members_allowed_repository_creation_type", mcp.Description("Input parameter: Specifies which types of repositories non-admin organization members can create. `private` is only available to repositories that are part of an organization on GitHub Enterprise Cloud. \n**Note:** This parameter is closing down and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in `members_can_create_repositories`. See the parameter deprecation notice in the operation description for details.")), + mcp.WithString("name", mcp.Description("Input parameter: The shorthand name of the company.")), + mcp.WithBoolean("has_repository_projects", mcp.Description("Input parameter: Whether repositories that belong to the organization can use repository projects.")), + mcp.WithBoolean("web_commit_signoff_required", mcp.Description("Input parameter: Whether contributors to organization repositories are required to sign off on commits they make through GitHub's web interface.")), mcp.WithBoolean("secret_scanning_push_protection_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether secret scanning push protection is automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), mcp.WithBoolean("secret_scanning_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether secret scanning is automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), - mcp.WithBoolean("has_repository_projects", mcp.Description("Input parameter: Whether repositories that belong to the organization can use repository projects.")), - mcp.WithString("company", mcp.Description("Input parameter: The company name.")), - mcp.WithString("twitter_username", mcp.Description("Input parameter: The Twitter username of the company.")), - mcp.WithBoolean("members_can_create_internal_repositories", mcp.Description("Input parameter: Whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see \"[Restricting repository creation in your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)\" in the GitHub Help documentation.")), mcp.WithBoolean("secret_scanning_push_protection_custom_link_enabled", mcp.Description("Input parameter: Whether a custom link is shown to contributors who are blocked from pushing a secret by push protection.")), - mcp.WithString("billing_email", mcp.Description("Input parameter: Billing email address. This address is not publicized.")), + mcp.WithBoolean("members_can_create_public_repositories", mcp.Description("Input parameter: Whether organization members can create public repositories, which are visible to anyone. For more information, see \"[Restricting repository creation in your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)\" in the GitHub Help documentation.")), + mcp.WithBoolean("members_can_create_repositories", mcp.Description("Input parameter: Whether of non-admin organization members can create repositories. **Note:** A parameter can override this parameter. See `members_allowed_repository_creation_type` in this table for details.")), + mcp.WithString("twitter_username", mcp.Description("Input parameter: The Twitter username of the company.")), + mcp.WithBoolean("members_can_create_private_pages", mcp.Description("Input parameter: Whether organization members can create private GitHub Pages sites. Existing published sites will not be impacted.")), + mcp.WithString("default_repository_permission", mcp.Description("Input parameter: Default permission level members have for organization repositories.")), + mcp.WithString("description", mcp.Description("Input parameter: The description of the company. The maximum size is 160 characters.")), + mcp.WithBoolean("members_can_create_public_pages", mcp.Description("Input parameter: Whether organization members can create public GitHub Pages sites. Existing published sites will not be impacted.")), + mcp.WithBoolean("advanced_security_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether GitHub Advanced Security is automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), + mcp.WithString("email", mcp.Description("Input parameter: The publicly visible email address.")), mcp.WithString("secret_scanning_push_protection_custom_link", mcp.Description("Input parameter: If `secret_scanning_push_protection_custom_link_enabled` is true, the URL that will be displayed to contributors who are blocked from pushing a secret.")), - mcp.WithBoolean("web_commit_signoff_required", mcp.Description("Input parameter: Whether contributors to organization repositories are required to sign off on commits they make through GitHub's web interface.")), + mcp.WithBoolean("dependency_graph_enabled_for_new_repositories", mcp.Description("Input parameter: **Endpoint closing down notice.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead.\n\nWhether dependency graph is automatically enabled for new repositories and repositories transferred to this organization.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nYou can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request.")), ) return models.Tool{ diff --git a/MCP/go/tools/orgs/orgs_update_issue_type.go b/MCP/go/tools/orgs/orgs_update_issue_type.go index 7fa8ac9..dc634f1 100644 --- a/MCP/go/tools/orgs/orgs_update_issue_type.go +++ b/MCP/go/tools/orgs/orgs_update_issue_type.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Orgs_update_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_type_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Organization_update_issue_type // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Orgs_update_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/issue-types/%s%s", cfg.BaseURL, org, issue_type_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/issue-types/%s", cfg.BaseURL, org, issue_type_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Orgs_update_issue_typeHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Issue_type if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,10 +108,10 @@ func CreateOrgs_update_issue_typeTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update issue type for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("issue_type_id", mcp.Required(), mcp.Description("The unique identifier of the issue type.")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: Name of the issue type.")), mcp.WithString("color", mcp.Description("Input parameter: Color for the issue type.")), mcp.WithString("description", mcp.Description("Input parameter: Description of the issue type.")), mcp.WithBoolean("is_enabled", mcp.Required(), mcp.Description("Input parameter: Whether or not the issue type is enabled at the organization level.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: Name of the issue type.")), ) return models.Tool{ diff --git a/MCP/go/tools/orgs/orgs_update_membership_for_authenticated_user.go b/MCP/go/tools/orgs/orgs_update_membership_for_authenticated_user.go index afddf79..70850fd 100644 --- a/MCP/go/tools/orgs/orgs_update_membership_for_authenticated_user.go +++ b/MCP/go/tools/orgs/orgs_update_membership_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_update_membership_for_authenticated_userHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_update_membership_for_authenticated_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/memberships/orgs/%s%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/user/memberships/orgs/%s", cfg.BaseURL, org) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Orgs_update_membership_for_authenticated_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/orgs/orgs_update_pat_access.go b/MCP/go/tools/orgs/orgs_update_pat_access.go index 9efbce4..93c90cb 100644 --- a/MCP/go/tools/orgs/orgs_update_pat_access.go +++ b/MCP/go/tools/orgs/orgs_update_pat_access.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Orgs_update_pat_accessHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: pat_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Orgs_update_pat_accessHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/personal-access-tokens/%s%s", cfg.BaseURL, org, pat_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/personal-access-tokens/%s", cfg.BaseURL, org, pat_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_update_pat_accesses.go b/MCP/go/tools/orgs/orgs_update_pat_accesses.go index f26de3d..bf78105 100644 --- a/MCP/go/tools/orgs/orgs_update_pat_accesses.go +++ b/MCP/go/tools/orgs/orgs_update_pat_accesses.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Orgs_update_pat_accessesHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Orgs_update_pat_accessesHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/personal-access-tokens%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/personal-access-tokens", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/orgs/orgs_update_webhook.go b/MCP/go/tools/orgs/orgs_update_webhook.go index def0232..87c24b4 100644 --- a/MCP/go/tools/orgs/orgs_update_webhook.go +++ b/MCP/go/tools/orgs/orgs_update_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Orgs_update_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Orgs_update_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s%s", cfg.BaseURL, org, hook_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s", cfg.BaseURL, org, hook_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Orgs_update_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_hook if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,10 +108,10 @@ func CreateOrgs_update_webhookTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update an organization webhook"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithNumber("hook_id", mcp.Required(), mcp.Description("The unique identifier of the hook. You can find this value in the `X-GitHub-Hook-ID` header of a webhook delivery.")), - mcp.WithString("name", mcp.Description("")), mcp.WithBoolean("active", mcp.Description("Input parameter: Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.")), mcp.WithObject("config", mcp.Description("Input parameter: Key/value pairs to provide settings for this webhook.")), mcp.WithArray("events", mcp.Description("Input parameter: Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for.")), + mcp.WithString("name", mcp.Description("")), ) return models.Tool{ diff --git a/MCP/go/tools/orgs/orgs_update_webhook_config_for_org.go b/MCP/go/tools/orgs/orgs_update_webhook_config_for_org.go index a2d94b6..2486830 100644 --- a/MCP/go/tools/orgs/orgs_update_webhook_config_for_org.go +++ b/MCP/go/tools/orgs/orgs_update_webhook_config_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Orgs_update_webhook_config_for_orgHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Orgs_update_webhook_config_for_orgHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/hooks/%s/config%s", cfg.BaseURL, org, hook_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/hooks/%s/config", cfg.BaseURL, org, hook_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Orgs_update_webhook_config_for_orgHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Webhook_config if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_delete_package_for_authenticated_user.go b/MCP/go/tools/packages/packages_delete_package_for_authenticated_user.go index 6c22d46..b48232d 100644 --- a/MCP/go/tools/packages/packages_delete_package_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_delete_package_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Packages_delete_package_for_authenticated_userHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: package_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/packages/%s/%s%s", cfg.BaseURL, package_type, package_name, queryString) + url := fmt.Sprintf("%s/user/packages/%s/%s", cfg.BaseURL, package_type, package_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Packages_delete_package_for_authenticated_userHandler(cfg *config.APIConfig } func CreatePackages_delete_package_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_user_packages_package_type_package_name", + tool := mcp.NewTool("delete_user_packages_package_type_name", mcp.WithDescription("Delete a package for the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_delete_package_for_org.go b/MCP/go/tools/packages/packages_delete_package_for_org.go index 9e4eabb..9dda256 100644 --- a/MCP/go/tools/packages/packages_delete_package_for_org.go +++ b/MCP/go/tools/packages/packages_delete_package_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_delete_package_for_orgHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s%s", cfg.BaseURL, package_type, package_name, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s", cfg.BaseURL, package_type, package_name, org) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Packages_delete_package_for_orgHandler(cfg *config.APIConfig) func(ctx cont } func CreatePackages_delete_package_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_packages_package_type_package_name", + tool := mcp.NewTool("delete_orgs_org_packages_package_type_name", mcp.WithDescription("Delete a package for an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_delete_package_for_user.go b/MCP/go/tools/packages/packages_delete_package_for_user.go index 89ee531..3357ec3 100644 --- a/MCP/go/tools/packages/packages_delete_package_for_user.go +++ b/MCP/go/tools/packages/packages_delete_package_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_delete_package_for_userHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/packages/%s/%s%s", cfg.BaseURL, package_type, package_name, username, queryString) + url := fmt.Sprintf("%s/users/%s/packages/%s/%s", cfg.BaseURL, package_type, package_name, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Packages_delete_package_for_userHandler(cfg *config.APIConfig) func(ctx con } func CreatePackages_delete_package_for_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_users_username_packages_package_type_package_name", + tool := mcp.NewTool("delete_users_username_packages_package_type_name", mcp.WithDescription("Delete a package for a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_delete_package_version_for_authenticated_user.go b/MCP/go/tools/packages/packages_delete_package_version_for_authenticated_user.go index 7127031..374e42a 100644 --- a/MCP/go/tools/packages/packages_delete_package_version_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_delete_package_version_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_delete_package_version_for_authenticated_userHandler(cfg *config.A if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/packages/%s/%s/versions/%s%s", cfg.BaseURL, package_type, package_name, package_version_id, queryString) + url := fmt.Sprintf("%s/user/packages/%s/%s/versions/%s", cfg.BaseURL, package_type, package_name, package_version_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Packages_delete_package_version_for_authenticated_userHandler(cfg *config.A } func CreatePackages_delete_package_version_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_user_packages_package_type_package_name_versions_package_version_id", + tool := mcp.NewTool("delete_user_packages_package_type_name_versions_version_id", mcp.WithDescription("Delete a package version for the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_delete_package_version_for_org.go b/MCP/go/tools/packages/packages_delete_package_version_for_org.go index 5bc90db..9520446 100644 --- a/MCP/go/tools/packages/packages_delete_package_version_for_org.go +++ b/MCP/go/tools/packages/packages_delete_package_version_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Packages_delete_package_version_for_orgHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s/versions/%s%s", cfg.BaseURL, package_type, package_name, org, package_version_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s/versions/%s", cfg.BaseURL, package_type, package_name, org, package_version_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Packages_delete_package_version_for_orgHandler(cfg *config.APIConfig) func( } func CreatePackages_delete_package_version_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_packages_package_type_package_name_versions_package_version_id", + tool := mcp.NewTool("delete_orgs_org_packages_package_type_name_versions_version", mcp.WithDescription("Delete package version for an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_delete_package_version_for_user.go b/MCP/go/tools/packages/packages_delete_package_version_for_user.go index 37f2796..3f443f0 100644 --- a/MCP/go/tools/packages/packages_delete_package_version_for_user.go +++ b/MCP/go/tools/packages/packages_delete_package_version_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Packages_delete_package_version_for_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions/%s%s", cfg.BaseURL, package_type, package_name, username, package_version_id, queryString) + url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions/%s", cfg.BaseURL, package_type, package_name, username, package_version_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Packages_delete_package_version_for_userHandler(cfg *config.APIConfig) func } func CreatePackages_delete_package_version_for_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_users_username_packages_package_type_package_name_versions_package_version_id", + tool := mcp.NewTool("delete_users_username_packages_package_type_name_versions", mcp.WithDescription("Delete package version for a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_authenticated_user.go b/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_authenticated_user.go index a8b41f8..142c272 100644 --- a/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_authenticated_user.go +++ b/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_authenticated_user.go @@ -45,34 +45,6 @@ func Packages_get_all_package_versions_for_package_owned_by_authenticated_userHa if val, ok := args["state"]; ok { queryParams = append(queryParams, fmt.Sprintf("state=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Packages_get_all_package_versions_for_package_owned_by_authenticated_userHa if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Packages_get_all_package_versions_for_package_owned_by_authenticated_userHa return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Package_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -126,7 +101,7 @@ func Packages_get_all_package_versions_for_package_owned_by_authenticated_userHa } func CreatePackages_get_all_package_versions_for_package_owned_by_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_user_packages_package_type_package_name_versions", + tool := mcp.NewTool("get_user_packages_package_type_name_versions", mcp.WithDescription("List package versions for a package owned by the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_org.go b/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_org.go index 02b16fd..f816ee8 100644 --- a/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_org.go +++ b/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_org.go @@ -53,34 +53,6 @@ func Packages_get_all_package_versions_for_package_owned_by_orgHandler(cfg *conf if val, ok := args["state"]; ok { queryParams = append(queryParams, fmt.Sprintf("state=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Packages_get_all_package_versions_for_package_owned_by_orgHandler(cfg *conf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Packages_get_all_package_versions_for_package_owned_by_orgHandler(cfg *conf return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Package_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -134,7 +109,7 @@ func Packages_get_all_package_versions_for_package_owned_by_orgHandler(cfg *conf } func CreatePackages_get_all_package_versions_for_package_owned_by_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_packages_package_type_package_name_versions", + tool := mcp.NewTool("get_orgs_org_packages_package_type_name_versions", mcp.WithDescription("List package versions for a package owned by an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_user.go b/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_user.go index 6c9a578..5963fdc 100644 --- a/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_user.go +++ b/MCP/go/tools/packages/packages_get_all_package_versions_for_package_owned_by_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_get_all_package_versions_for_package_owned_by_userHandler(cfg *con if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions%s", cfg.BaseURL, package_type, package_name, username, queryString) + url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions", cfg.BaseURL, package_type, package_name, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Packages_get_all_package_versions_for_package_owned_by_userHandler(cfg *con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Package_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Packages_get_all_package_versions_for_package_owned_by_userHandler(cfg *con } func CreatePackages_get_all_package_versions_for_package_owned_by_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_users_username_packages_package_type_package_name_versions", + tool := mcp.NewTool("get_users_username_packages_package_type_name_versions", mcp.WithDescription("List package versions for a package owned by a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_package_for_authenticated_user.go b/MCP/go/tools/packages/packages_get_package_for_authenticated_user.go index 40a827f..89ef8e0 100644 --- a/MCP/go/tools/packages/packages_get_package_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_get_package_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Packages_get_package_for_authenticated_userHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: package_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/packages/%s/%s%s", cfg.BaseURL, package_type, package_name, queryString) + url := fmt.Sprintf("%s/user/packages/%s/%s", cfg.BaseURL, package_type, package_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Packages_get_package_for_authenticated_userHandler(cfg *config.APIConfig) f } func CreatePackages_get_package_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_user_packages_package_type_package_name", + tool := mcp.NewTool("get_user_packages_package_type_name", mcp.WithDescription("Get a package for the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_package_for_organization.go b/MCP/go/tools/packages/packages_get_package_for_organization.go index f043960..26c891d 100644 --- a/MCP/go/tools/packages/packages_get_package_for_organization.go +++ b/MCP/go/tools/packages/packages_get_package_for_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_get_package_for_organizationHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s%s", cfg.BaseURL, package_type, package_name, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s", cfg.BaseURL, package_type, package_name, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Packages_get_package_for_organizationHandler(cfg *config.APIConfig) func(ct } func CreatePackages_get_package_for_organizationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_packages_package_type_package_name", + tool := mcp.NewTool("get_orgs_org_packages_package_type_name", mcp.WithDescription("Get a package for an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_package_for_user.go b/MCP/go/tools/packages/packages_get_package_for_user.go index 28503d6..7869079 100644 --- a/MCP/go/tools/packages/packages_get_package_for_user.go +++ b/MCP/go/tools/packages/packages_get_package_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_get_package_for_userHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/packages/%s/%s%s", cfg.BaseURL, package_type, package_name, username, queryString) + url := fmt.Sprintf("%s/users/%s/packages/%s/%s", cfg.BaseURL, package_type, package_name, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Packages_get_package_for_userHandler(cfg *config.APIConfig) func(ctx contex } func CreatePackages_get_package_for_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_users_username_packages_package_type_package_name", + tool := mcp.NewTool("get_users_username_packages_package_type_name", mcp.WithDescription("Get a package for a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_package_version_for_authenticated_user.go b/MCP/go/tools/packages/packages_get_package_version_for_authenticated_user.go index bc81813..cfa29e2 100644 --- a/MCP/go/tools/packages/packages_get_package_version_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_get_package_version_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_get_package_version_for_authenticated_userHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/packages/%s/%s/versions/%s%s", cfg.BaseURL, package_type, package_name, package_version_id, queryString) + url := fmt.Sprintf("%s/user/packages/%s/%s/versions/%s", cfg.BaseURL, package_type, package_name, package_version_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Packages_get_package_version_for_authenticated_userHandler(cfg *config.APIC return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Package_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Packages_get_package_version_for_authenticated_userHandler(cfg *config.APIC } func CreatePackages_get_package_version_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_user_packages_package_type_package_name_versions_package_version_id", + tool := mcp.NewTool("get_user_packages_package_type_name_versions_version_id", mcp.WithDescription("Get a package version for the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_package_version_for_organization.go b/MCP/go/tools/packages/packages_get_package_version_for_organization.go index 97d88dc..8a05ff1 100644 --- a/MCP/go/tools/packages/packages_get_package_version_for_organization.go +++ b/MCP/go/tools/packages/packages_get_package_version_for_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Packages_get_package_version_for_organizationHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s/versions/%s%s", cfg.BaseURL, package_type, package_name, org, package_version_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s/versions/%s", cfg.BaseURL, package_type, package_name, org, package_version_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Packages_get_package_version_for_organizationHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Package_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Packages_get_package_version_for_organizationHandler(cfg *config.APIConfig) } func CreatePackages_get_package_version_for_organizationTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_packages_package_type_package_name_versions_package_version_id", + tool := mcp.NewTool("get_orgs_org_packages_package_type_name_versions_version_id", mcp.WithDescription("Get a package version for an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_get_package_version_for_user.go b/MCP/go/tools/packages/packages_get_package_version_for_user.go index 64d57dd..ecf9451 100644 --- a/MCP/go/tools/packages/packages_get_package_version_for_user.go +++ b/MCP/go/tools/packages/packages_get_package_version_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Packages_get_package_version_for_userHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions/%s%s", cfg.BaseURL, package_type, package_name, package_version_id, username, queryString) + url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions/%s", cfg.BaseURL, package_type, package_name, package_version_id, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Packages_get_package_version_for_userHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Package_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Packages_get_package_version_for_userHandler(cfg *config.APIConfig) func(ct } func CreatePackages_get_package_version_for_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_users_username_packages_package_type_package_name_versions_package_version_id", + tool := mcp.NewTool("get_users_username_packages_package_type_name_versions", mcp.WithDescription("Get a package version for a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_authenticated_user.go b/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_authenticated_user.go index d06408b..aaf6044 100644 --- a/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Packages_list_docker_migration_conflicting_packages_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/docker/conflicts%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/docker/conflicts", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -81,7 +50,7 @@ func Packages_list_docker_migration_conflicting_packages_for_authenticated_userH return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Package + var result []models.Package if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_organization.go b/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_organization.go index 3f2dbee..393c986 100644 --- a/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_organization.go +++ b/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_organization.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Packages_list_docker_migration_conflicting_packages_for_organizationHandler if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/docker/conflicts%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/docker/conflicts", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Packages_list_docker_migration_conflicting_packages_for_organizationHandler return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Package + var result []models.Package if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_user.go b/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_user.go index e15e191..149db52 100644 --- a/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_user.go +++ b/MCP/go/tools/packages/packages_list_docker_migration_conflicting_packages_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Packages_list_docker_migration_conflicting_packages_for_userHandler(cfg *co if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/docker/conflicts%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s/docker/conflicts", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Packages_list_docker_migration_conflicting_packages_for_userHandler(cfg *co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Package + var result []models.Package if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_list_packages_for_authenticated_user.go b/MCP/go/tools/packages/packages_list_packages_for_authenticated_user.go index 77af16f..0b555a8 100644 --- a/MCP/go/tools/packages/packages_list_packages_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_list_packages_for_authenticated_user.go @@ -32,34 +32,6 @@ func Packages_list_packages_for_authenticated_userHandler(cfg *config.APIConfig) if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -69,17 +41,20 @@ func Packages_list_packages_for_authenticated_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -97,7 +72,7 @@ func Packages_list_packages_for_authenticated_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Package + var result []models.Package if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_list_packages_for_organization.go b/MCP/go/tools/packages/packages_list_packages_for_organization.go index acd0606..5f6368f 100644 --- a/MCP/go/tools/packages/packages_list_packages_for_organization.go +++ b/MCP/go/tools/packages/packages_list_packages_for_organization.go @@ -40,34 +40,6 @@ func Packages_list_packages_for_organizationHandler(cfg *config.APIConfig) func( if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Packages_list_packages_for_organizationHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Packages_list_packages_for_organizationHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Package + var result []models.Package if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_list_packages_for_user.go b/MCP/go/tools/packages/packages_list_packages_for_user.go index 1147227..c757aad 100644 --- a/MCP/go/tools/packages/packages_list_packages_for_user.go +++ b/MCP/go/tools/packages/packages_list_packages_for_user.go @@ -40,34 +40,6 @@ func Packages_list_packages_for_userHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -77,17 +49,20 @@ func Packages_list_packages_for_userHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -105,7 +80,7 @@ func Packages_list_packages_for_userHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Package + var result []models.Package if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/packages/packages_restore_package_for_authenticated_user.go b/MCP/go/tools/packages/packages_restore_package_for_authenticated_user.go index f1ba1ca..5d168d0 100644 --- a/MCP/go/tools/packages/packages_restore_package_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_restore_package_for_authenticated_user.go @@ -39,34 +39,6 @@ func Packages_restore_package_for_authenticated_userHandler(cfg *config.APIConfi if val, ok := args["token"]; ok { queryParams = append(queryParams, fmt.Sprintf("token=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Packages_restore_package_for_authenticated_userHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -120,7 +95,7 @@ func Packages_restore_package_for_authenticated_userHandler(cfg *config.APIConfi } func CreatePackages_restore_package_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_user_packages_package_type_package_name_restore", + tool := mcp.NewTool("post_user_packages_package_type_name_restore", mcp.WithDescription("Restore a package for the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_restore_package_for_org.go b/MCP/go/tools/packages/packages_restore_package_for_org.go index 649afb1..c4e3262 100644 --- a/MCP/go/tools/packages/packages_restore_package_for_org.go +++ b/MCP/go/tools/packages/packages_restore_package_for_org.go @@ -47,34 +47,6 @@ func Packages_restore_package_for_orgHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["token"]; ok { queryParams = append(queryParams, fmt.Sprintf("token=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Packages_restore_package_for_orgHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -128,7 +103,7 @@ func Packages_restore_package_for_orgHandler(cfg *config.APIConfig) func(ctx con } func CreatePackages_restore_package_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_packages_package_type_package_name_restore", + tool := mcp.NewTool("post_orgs_org_packages_package_type_name_restore", mcp.WithDescription("Restore a package for an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_restore_package_for_user.go b/MCP/go/tools/packages/packages_restore_package_for_user.go index ed6a1c3..e7be859 100644 --- a/MCP/go/tools/packages/packages_restore_package_for_user.go +++ b/MCP/go/tools/packages/packages_restore_package_for_user.go @@ -47,34 +47,6 @@ func Packages_restore_package_for_userHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["token"]; ok { queryParams = append(queryParams, fmt.Sprintf("token=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Packages_restore_package_for_userHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -128,7 +103,7 @@ func Packages_restore_package_for_userHandler(cfg *config.APIConfig) func(ctx co } func CreatePackages_restore_package_for_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_users_username_packages_package_type_package_name_restore", + tool := mcp.NewTool("post_users_username_packages_package_type_name_restore", mcp.WithDescription("Restore a package for a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_restore_package_version_for_authenticated_user.go b/MCP/go/tools/packages/packages_restore_package_version_for_authenticated_user.go index afd6152..d2570e4 100644 --- a/MCP/go/tools/packages/packages_restore_package_version_for_authenticated_user.go +++ b/MCP/go/tools/packages/packages_restore_package_version_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Packages_restore_package_version_for_authenticated_userHandler(cfg *config. if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/packages/%s/%s/versions/%s/restore%s", cfg.BaseURL, package_type, package_name, package_version_id, queryString) + url := fmt.Sprintf("%s/user/packages/%s/%s/versions/%s/restore", cfg.BaseURL, package_type, package_name, package_version_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Packages_restore_package_version_for_authenticated_userHandler(cfg *config. } func CreatePackages_restore_package_version_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_user_packages_package_type_package_name_versions_package_version_id_restore", + tool := mcp.NewTool("post_user_packages_package_type_name_versions_version_id", mcp.WithDescription("Restore a package version for the authenticated user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_restore_package_version_for_org.go b/MCP/go/tools/packages/packages_restore_package_version_for_org.go index 9eb45f6..b6136b4 100644 --- a/MCP/go/tools/packages/packages_restore_package_version_for_org.go +++ b/MCP/go/tools/packages/packages_restore_package_version_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Packages_restore_package_version_for_orgHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s/versions/%s/restore%s", cfg.BaseURL, package_type, package_name, org, package_version_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/packages/%s/%s/versions/%s/restore", cfg.BaseURL, package_type, package_name, org, package_version_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Packages_restore_package_version_for_orgHandler(cfg *config.APIConfig) func } func CreatePackages_restore_package_version_for_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_packages_package_type_package_name_versions_package_version_id_restore", + tool := mcp.NewTool("post_orgs_org_packages_package_type_name_versions_version_id", mcp.WithDescription("Restore package version for an organization"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/packages/packages_restore_package_version_for_user.go b/MCP/go/tools/packages/packages_restore_package_version_for_user.go index e035732..812a4ad 100644 --- a/MCP/go/tools/packages/packages_restore_package_version_for_user.go +++ b/MCP/go/tools/packages/packages_restore_package_version_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Packages_restore_package_version_for_userHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: package_version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions/%s/restore%s", cfg.BaseURL, package_type, package_name, username, package_version_id, queryString) + url := fmt.Sprintf("%s/users/%s/packages/%s/%s/versions/%s/restore", cfg.BaseURL, package_type, package_name, username, package_version_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Packages_restore_package_version_for_userHandler(cfg *config.APIConfig) fun } func CreatePackages_restore_package_version_for_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_users_username_packages_package_type_package_name_versions_package_version_id_restore", + tool := mcp.NewTool("post_users_username_packages_package_type_name_versions", mcp.WithDescription("Restore package version for a user"), mcp.WithString("package_type", mcp.Required(), mcp.Description("The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.")), mcp.WithString("package_name", mcp.Required(), mcp.Description("The name of the package.")), diff --git a/MCP/go/tools/private_registries/private_registries_create_org_private_registry.go b/MCP/go/tools/private_registries/private_registries_create_org_private_registry.go index 198ecb7..2e5b751 100644 --- a/MCP/go/tools/private_registries/private_registries_create_org_private_registry.go +++ b/MCP/go/tools/private_registries/private_registries_create_org_private_registry.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Private_registries_create_org_private_registryHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Private_registries_create_org_private_registryHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/private-registries%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/private-registries", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Private_registries_create_org_private_registryHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_private_registry_configuration_with_selected_repositories if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,13 +99,13 @@ func CreatePrivate_registries_create_org_private_registryTool(cfg *config.APICon tool := mcp.NewTool("post_orgs_org_private-registries", mcp.WithDescription("Create a private registry for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), + mcp.WithString("registry_type", mcp.Required(), mcp.Description("Input parameter: The registry type.")), + mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository IDs that can access the organization private registry. You can only provide a list of repository IDs when `visibility` is set to `selected`. You can manage the list of selected repositories using the [Update a private registry for an organization](https://docs.github.com/rest/private-registries/organization-configurations#update-a-private-registry-for-an-organization) endpoint. This field should be omitted if `visibility` is set to `all` or `private`.")), mcp.WithString("url", mcp.Required(), mcp.Description("Input parameter: The URL of the private registry.")), mcp.WithString("username", mcp.Description("Input parameter: The username to use when authenticating with the private registry. This field should be omitted if the private registry does not require a username for authentication.")), mcp.WithString("visibility", mcp.Required(), mcp.Description("Input parameter: Which type of organization repositories have access to the private registry. `selected` means only the repositories specified by `selected_repository_ids` can access the private registry.")), mcp.WithString("encrypted_value", mcp.Required(), mcp.Description("Input parameter: The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get private registries public key for an organization](https://docs.github.com/rest/private-registries/organization-configurations#get-private-registries-public-key-for-an-organization) endpoint.")), mcp.WithString("key_id", mcp.Required(), mcp.Description("Input parameter: The ID of the key you used to encrypt the secret.")), - mcp.WithString("registry_type", mcp.Required(), mcp.Description("Input parameter: The registry type.")), - mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository IDs that can access the organization private registry. You can only provide a list of repository IDs when `visibility` is set to `selected`. You can manage the list of selected repositories using the [Update a private registry for an organization](https://docs.github.com/rest/private-registries/organization-configurations#update-a-private-registry-for-an-organization) endpoint. This field should be omitted if `visibility` is set to `all` or `private`.")), ) return models.Tool{ diff --git a/MCP/go/tools/private_registries/private_registries_delete_org_private_registry.go b/MCP/go/tools/private_registries/private_registries_delete_org_private_registry.go index 3a27d83..6d717e5 100644 --- a/MCP/go/tools/private_registries/private_registries_delete_org_private_registry.go +++ b/MCP/go/tools/private_registries/private_registries_delete_org_private_registry.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Private_registries_delete_org_private_registryHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/private-registries/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/private-registries/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/private_registries/private_registries_get_org_private_registry.go b/MCP/go/tools/private_registries/private_registries_get_org_private_registry.go index beb0ffa..75409b6 100644 --- a/MCP/go/tools/private_registries/private_registries_get_org_private_registry.go +++ b/MCP/go/tools/private_registries/private_registries_get_org_private_registry.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Private_registries_get_org_private_registryHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/private-registries/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/private-registries/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Private_registries_get_org_private_registryHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Org_private_registry_configuration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/private_registries/private_registries_get_org_public_key.go b/MCP/go/tools/private_registries/private_registries_get_org_public_key.go index 8825c61..65fabc5 100644 --- a/MCP/go/tools/private_registries/private_registries_get_org_public_key.go +++ b/MCP/go/tools/private_registries/private_registries_get_org_public_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Private_registries_get_org_public_keyHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/private-registries/public-key%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/private-registries/public-key", cfg.BaseURL, org) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/private_registries/private_registries_list_org_private_registries.go b/MCP/go/tools/private_registries/private_registries_list_org_private_registries.go index f6c0d95..8753df6 100644 --- a/MCP/go/tools/private_registries/private_registries_list_org_private_registries.go +++ b/MCP/go/tools/private_registries/private_registries_list_org_private_registries.go @@ -34,34 +34,6 @@ func Private_registries_list_org_private_registriesHandler(cfg *config.APIConfig if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Private_registries_list_org_private_registriesHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/private_registries/private_registries_update_org_private_registry.go b/MCP/go/tools/private_registries/private_registries_update_org_private_registry.go index 686d462..809d0b7 100644 --- a/MCP/go/tools/private_registries/private_registries_update_org_private_registry.go +++ b/MCP/go/tools/private_registries/private_registries_update_org_private_registry.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Private_registries_update_org_private_registryHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: secret_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Private_registries_update_org_private_registryHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/private-registries/%s%s", cfg.BaseURL, org, secret_name, queryString) + url := fmt.Sprintf("%s/orgs/%s/private-registries/%s", cfg.BaseURL, org, secret_name) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,13 +108,13 @@ func CreatePrivate_registries_update_org_private_registryTool(cfg *config.APICon mcp.WithDescription("Update a private registry for an organization"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("secret_name", mcp.Required(), mcp.Description("The name of the secret.")), + mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository IDs that can access the organization private registry. You can only provide a list of repository IDs when `visibility` is set to `selected`. This field should be omitted if `visibility` is set to `all` or `private`.")), + mcp.WithString("url", mcp.Description("Input parameter: The URL of the private registry.")), mcp.WithString("username", mcp.Description("Input parameter: The username to use when authenticating with the private registry. This field should be omitted if the private registry does not require a username for authentication.")), mcp.WithString("visibility", mcp.Description("Input parameter: Which type of organization repositories have access to the private registry. `selected` means only the repositories specified by `selected_repository_ids` can access the private registry.")), mcp.WithString("encrypted_value", mcp.Description("Input parameter: The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get private registries public key for an organization](https://docs.github.com/rest/private-registries/organization-configurations#get-private-registries-public-key-for-an-organization) endpoint.")), mcp.WithString("key_id", mcp.Description("Input parameter: The ID of the key you used to encrypt the secret.")), mcp.WithString("registry_type", mcp.Description("Input parameter: The registry type.")), - mcp.WithArray("selected_repository_ids", mcp.Description("Input parameter: An array of repository IDs that can access the organization private registry. You can only provide a list of repository IDs when `visibility` is set to `selected`. This field should be omitted if `visibility` is set to `all` or `private`.")), - mcp.WithString("url", mcp.Description("Input parameter: The URL of the private registry.")), ) return models.Tool{ diff --git a/MCP/go/tools/projects/projects_add_collaborator.go b/MCP/go/tools/projects/projects_add_collaborator.go index 2385005..a86e083 100644 --- a/MCP/go/tools/projects/projects_add_collaborator.go +++ b/MCP/go/tools/projects/projects_add_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Projects_add_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Projects_add_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/%s/collaborators/%s%s", cfg.BaseURL, project_id, username, queryString) + url := fmt.Sprintf("%s/projects/%s/collaborators/%s", cfg.BaseURL, project_id, username) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_create_card.go b/MCP/go/tools/projects/projects_create_card.go index 6f240b7..db08331 100644 --- a/MCP/go/tools/projects/projects_create_card.go +++ b/MCP/go/tools/projects/projects_create_card.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_create_cardHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: column_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -77,23 +43,26 @@ func Projects_create_cardHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/columns/%s/cards%s", cfg.BaseURL, column_id, queryString) + url := fmt.Sprintf("%s/projects/columns/%s/cards", cfg.BaseURL, column_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Projects_create_cardHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_card if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_create_column.go b/MCP/go/tools/projects/projects_create_column.go index 3a4eaa4..52a1331 100644 --- a/MCP/go/tools/projects/projects_create_column.go +++ b/MCP/go/tools/projects/projects_create_column.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_create_columnHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_create_columnHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/%s/columns%s", cfg.BaseURL, project_id, queryString) + url := fmt.Sprintf("%s/projects/%s/columns", cfg.BaseURL, project_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Projects_create_columnHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_column if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_create_for_authenticated_user.go b/MCP/go/tools/projects/projects_create_for_authenticated_user.go index d714537..a39353e 100644 --- a/MCP/go/tools/projects/projects_create_for_authenticated_user.go +++ b/MCP/go/tools/projects/projects_create_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Projects_create_for_authenticated_userHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Projects_create_for_authenticated_userHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/projects%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/projects", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_create_for_org.go b/MCP/go/tools/projects/projects_create_for_org.go index 65f765e..f45ac8e 100644 --- a/MCP/go/tools/projects/projects_create_for_org.go +++ b/MCP/go/tools/projects/projects_create_for_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_create_for_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_create_for_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/projects%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/projects", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_create_for_repo.go b/MCP/go/tools/projects/projects_create_for_repo.go index 64e39e6..3de234b 100644 --- a/MCP/go/tools/projects/projects_create_for_repo.go +++ b/MCP/go/tools/projects/projects_create_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Projects_create_for_repoHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Projects_create_for_repoHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/projects%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/projects", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_delete.go b/MCP/go/tools/projects/projects_delete.go index 6b41b3b..a586ecd 100644 --- a/MCP/go/tools/projects/projects_delete.go +++ b/MCP/go/tools/projects/projects_delete.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Projects_deleteHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/%s%s", cfg.BaseURL, project_id, queryString) + url := fmt.Sprintf("%s/projects/%s", cfg.BaseURL, project_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_delete_card.go b/MCP/go/tools/projects/projects_delete_card.go index 72b8636..c737748 100644 --- a/MCP/go/tools/projects/projects_delete_card.go +++ b/MCP/go/tools/projects/projects_delete_card.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Projects_delete_cardHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: card_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/columns/cards/%s%s", cfg.BaseURL, card_id, queryString) + url := fmt.Sprintf("%s/projects/columns/cards/%s", cfg.BaseURL, card_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_delete_column.go b/MCP/go/tools/projects/projects_delete_column.go index 192ecbe..a7dc564 100644 --- a/MCP/go/tools/projects/projects_delete_column.go +++ b/MCP/go/tools/projects/projects_delete_column.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Projects_delete_columnHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: column_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/columns/%s%s", cfg.BaseURL, column_id, queryString) + url := fmt.Sprintf("%s/projects/columns/%s", cfg.BaseURL, column_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_get.go b/MCP/go/tools/projects/projects_get.go index 266be1e..95da312 100644 --- a/MCP/go/tools/projects/projects_get.go +++ b/MCP/go/tools/projects/projects_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Projects_getHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/%s%s", cfg.BaseURL, project_id, queryString) + url := fmt.Sprintf("%s/projects/%s", cfg.BaseURL, project_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_get_card.go b/MCP/go/tools/projects/projects_get_card.go index 69edd40..8590087 100644 --- a/MCP/go/tools/projects/projects_get_card.go +++ b/MCP/go/tools/projects/projects_get_card.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Projects_get_cardHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: card_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/columns/cards/%s%s", cfg.BaseURL, card_id, queryString) + url := fmt.Sprintf("%s/projects/columns/cards/%s", cfg.BaseURL, card_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Projects_get_cardHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_card if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_get_column.go b/MCP/go/tools/projects/projects_get_column.go index e9da2e9..97a0c4f 100644 --- a/MCP/go/tools/projects/projects_get_column.go +++ b/MCP/go/tools/projects/projects_get_column.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Projects_get_columnHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: column_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/columns/%s%s", cfg.BaseURL, column_id, queryString) + url := fmt.Sprintf("%s/projects/columns/%s", cfg.BaseURL, column_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Projects_get_columnHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_column if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_get_permission_for_user.go b/MCP/go/tools/projects/projects_get_permission_for_user.go index cf492d4..119beae 100644 --- a/MCP/go/tools/projects/projects_get_permission_for_user.go +++ b/MCP/go/tools/projects/projects_get_permission_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Projects_get_permission_for_userHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/%s/collaborators/%s/permission%s", cfg.BaseURL, project_id, username, queryString) + url := fmt.Sprintf("%s/projects/%s/collaborators/%s/permission", cfg.BaseURL, project_id, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Projects_get_permission_for_userHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_collaborator_permission if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_list_cards.go b/MCP/go/tools/projects/projects_list_cards.go index 12c52a6..d1025ff 100644 --- a/MCP/go/tools/projects/projects_list_cards.go +++ b/MCP/go/tools/projects/projects_list_cards.go @@ -37,34 +37,6 @@ func Projects_list_cardsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Projects_list_cardsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Projects_list_cardsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Project_card if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_list_collaborators.go b/MCP/go/tools/projects/projects_list_collaborators.go index 5455e47..50e9f9c 100644 --- a/MCP/go/tools/projects/projects_list_collaborators.go +++ b/MCP/go/tools/projects/projects_list_collaborators.go @@ -37,34 +37,6 @@ func Projects_list_collaboratorsHandler(cfg *config.APIConfig) func(ctx context. if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Projects_list_collaboratorsHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Projects_list_collaboratorsHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_list_columns.go b/MCP/go/tools/projects/projects_list_columns.go index b177475..589aa3e 100644 --- a/MCP/go/tools/projects/projects_list_columns.go +++ b/MCP/go/tools/projects/projects_list_columns.go @@ -34,34 +34,6 @@ func Projects_list_columnsHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Projects_list_columnsHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Projects_list_columnsHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Project_column if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_list_for_org.go b/MCP/go/tools/projects/projects_list_for_org.go index 6198d9a..193b149 100644 --- a/MCP/go/tools/projects/projects_list_for_org.go +++ b/MCP/go/tools/projects/projects_list_for_org.go @@ -37,34 +37,6 @@ func Projects_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Projects_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Projects_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Project + var result []models.Project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_list_for_repo.go b/MCP/go/tools/projects/projects_list_for_repo.go index d99f382..3f8c156 100644 --- a/MCP/go/tools/projects/projects_list_for_repo.go +++ b/MCP/go/tools/projects/projects_list_for_repo.go @@ -45,34 +45,6 @@ func Projects_list_for_repoHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Projects_list_for_repoHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Projects_list_for_repoHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Project + var result []models.Project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_list_for_user.go b/MCP/go/tools/projects/projects_list_for_user.go index 9952451..7cdd03d 100644 --- a/MCP/go/tools/projects/projects_list_for_user.go +++ b/MCP/go/tools/projects/projects_list_for_user.go @@ -37,34 +37,6 @@ func Projects_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Projects_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Projects_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Project + var result []models.Project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/projects/projects_move_card.go b/MCP/go/tools/projects/projects_move_card.go index 0feb2ea..bd1baa5 100644 --- a/MCP/go/tools/projects/projects_move_card.go +++ b/MCP/go/tools/projects/projects_move_card.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_move_cardHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: card_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_move_cardHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/columns/cards/%s/moves%s", cfg.BaseURL, card_id, queryString) + url := fmt.Sprintf("%s/projects/columns/cards/%s/moves", cfg.BaseURL, card_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_move_column.go b/MCP/go/tools/projects/projects_move_column.go index 2ae5afd..736f871 100644 --- a/MCP/go/tools/projects/projects_move_column.go +++ b/MCP/go/tools/projects/projects_move_column.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_move_columnHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: column_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_move_columnHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/columns/%s/moves%s", cfg.BaseURL, column_id, queryString) + url := fmt.Sprintf("%s/projects/columns/%s/moves", cfg.BaseURL, column_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_remove_collaborator.go b/MCP/go/tools/projects/projects_remove_collaborator.go index 02e28fe..e9c20db 100644 --- a/MCP/go/tools/projects/projects_remove_collaborator.go +++ b/MCP/go/tools/projects/projects_remove_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Projects_remove_collaboratorHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/projects/%s/collaborators/%s%s", cfg.BaseURL, project_id, username, queryString) + url := fmt.Sprintf("%s/projects/%s/collaborators/%s", cfg.BaseURL, project_id, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/projects/projects_update.go b/MCP/go/tools/projects/projects_update.go index ef40311..0bb69b1 100644 --- a/MCP/go/tools/projects/projects_update.go +++ b/MCP/go/tools/projects/projects_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_updateHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_updateHandler(cfg *config.APIConfig) func(ctx context.Context, req if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/%s%s", cfg.BaseURL, project_id, queryString) + url := fmt.Sprintf("%s/projects/%s", cfg.BaseURL, project_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -130,11 +99,11 @@ func CreateProjects_updateTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("patch_projects_project_id", mcp.WithDescription("Update a project"), mcp.WithNumber("project_id", mcp.Required(), mcp.Description("The unique identifier of the project.")), + mcp.WithString("state", mcp.Description("Input parameter: State of the project; either 'open' or 'closed'")), mcp.WithString("body", mcp.Description("Input parameter: Body of the project")), mcp.WithString("name", mcp.Description("Input parameter: Name of the project")), mcp.WithString("organization_permission", mcp.Description("Input parameter: The baseline permission that all organization members have on this project")), mcp.WithBoolean("private", mcp.Description("Input parameter: Whether or not this project can be seen by everyone.")), - mcp.WithString("state", mcp.Description("Input parameter: State of the project; either 'open' or 'closed'")), ) return models.Tool{ diff --git a/MCP/go/tools/projects/projects_update_card.go b/MCP/go/tools/projects/projects_update_card.go index 948e059..bdf6686 100644 --- a/MCP/go/tools/projects/projects_update_card.go +++ b/MCP/go/tools/projects/projects_update_card.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_update_cardHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: card_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_update_cardHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/columns/cards/%s%s", cfg.BaseURL, card_id, queryString) + url := fmt.Sprintf("%s/projects/columns/cards/%s", cfg.BaseURL, card_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Projects_update_cardHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_card if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,8 +99,8 @@ func CreateProjects_update_cardTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("patch_projects_columns_cards_card_id", mcp.WithDescription("Update an existing project card"), mcp.WithNumber("card_id", mcp.Required(), mcp.Description("The unique identifier of the card.")), - mcp.WithBoolean("archived", mcp.Description("Input parameter: Whether or not the card is archived")), mcp.WithString("note", mcp.Description("Input parameter: The project card's note")), + mcp.WithBoolean("archived", mcp.Description("Input parameter: Whether or not the card is archived")), ) return models.Tool{ diff --git a/MCP/go/tools/projects/projects_update_column.go b/MCP/go/tools/projects/projects_update_column.go index 46a7125..98e3dbe 100644 --- a/MCP/go/tools/projects/projects_update_column.go +++ b/MCP/go/tools/projects/projects_update_column.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Projects_update_columnHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: column_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Projects_update_columnHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/projects/columns/%s%s", cfg.BaseURL, column_id, queryString) + url := fmt.Sprintf("%s/projects/columns/%s", cfg.BaseURL, column_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Projects_update_columnHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Project_column if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_check_if_merged.go b/MCP/go/tools/pulls/pulls_check_if_merged.go index 3c3e29a..23d27c0 100644 --- a/MCP/go/tools/pulls/pulls_check_if_merged.go +++ b/MCP/go/tools/pulls/pulls_check_if_merged.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Pulls_check_if_mergedHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/merge%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/merge", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/pulls/pulls_create.go b/MCP/go/tools/pulls/pulls_create.go index be868cb..8e06e90 100644 --- a/MCP/go/tools/pulls/pulls_create.go +++ b/MCP/go/tools/pulls/pulls_create.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Pulls_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Pulls_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Pulls_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,14 +108,14 @@ func CreatePulls_createTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a pull request"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("body", mcp.Description("Input parameter: The contents of the pull request.")), - mcp.WithBoolean("draft", mcp.Description("Input parameter: Indicates whether the pull request is a draft. See \"[Draft Pull Requests](https://docs.github.com/articles/about-pull-requests#draft-pull-requests)\" in the GitHub Help documentation to learn more.")), mcp.WithString("head", mcp.Required(), mcp.Description("Input parameter: The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head` with a user like this: `username:branch`.")), mcp.WithString("head_repo", mcp.Description("Input parameter: The name of the repository where the changes in the pull request were made. This field is required for cross-repository pull requests if both repositories are owned by the same organization.")), mcp.WithNumber("issue", mcp.Description("Input parameter: An issue in the repository to convert to a pull request. The issue title, body, and comments will become the title, body, and comments on the new pull request. Required unless `title` is specified.")), mcp.WithBoolean("maintainer_can_modify", mcp.Description("Input parameter: Indicates whether [maintainers can modify](https://docs.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request.")), mcp.WithString("title", mcp.Description("Input parameter: The title of the new pull request. Required unless `issue` is specified.")), mcp.WithString("base", mcp.Required(), mcp.Description("Input parameter: The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.")), + mcp.WithString("body", mcp.Description("Input parameter: The contents of the pull request.")), + mcp.WithBoolean("draft", mcp.Description("Input parameter: Indicates whether the pull request is a draft. See \"[Draft Pull Requests](https://docs.github.com/articles/about-pull-requests#draft-pull-requests)\" in the GitHub Help documentation to learn more.")), ) return models.Tool{ diff --git a/MCP/go/tools/pulls/pulls_create_reply_for_review_comment.go b/MCP/go/tools/pulls/pulls_create_reply_for_review_comment.go index 3787d39..73edfc6 100644 --- a/MCP/go/tools/pulls/pulls_create_reply_for_review_comment.go +++ b/MCP/go/tools/pulls/pulls_create_reply_for_review_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Pulls_create_reply_for_review_commentHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Pulls_create_reply_for_review_commentHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/comments/%s/replies%s", cfg.BaseURL, owner, repo, pull_number, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/comments/%s/replies", cfg.BaseURL, owner, repo, pull_number, comment_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Pulls_create_reply_for_review_commentHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -151,7 +120,7 @@ func Pulls_create_reply_for_review_commentHandler(cfg *config.APIConfig) func(ct } func CreatePulls_create_reply_for_review_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_pulls_pull_number_comments_comment_id_replies", + tool := mcp.NewTool("post_repos_owner_repo_pulls_pull_number_comments_comment_id", mcp.WithDescription("Create a reply for a review comment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/pulls/pulls_create_review.go b/MCP/go/tools/pulls/pulls_create_review.go index 69480ac..b1dbfee 100644 --- a/MCP/go/tools/pulls/pulls_create_review.go +++ b/MCP/go/tools/pulls/pulls_create_review.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_create_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_create_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_create_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_create_review_comment.go b/MCP/go/tools/pulls/pulls_create_review_comment.go index e6d44bd..14add42 100644 --- a/MCP/go/tools/pulls/pulls_create_review_comment.go +++ b/MCP/go/tools/pulls/pulls_create_review_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_create_review_commentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_create_review_commentHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/comments%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/comments", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_create_review_commentHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,16 +117,16 @@ func CreatePulls_create_review_commentTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("pull_number", mcp.Required(), mcp.Description("The number that identifies the pull request.")), - mcp.WithNumber("start_line", mcp.Description("Input parameter: **Required when using multi-line comments unless using `in_reply_to`**. The `start_line` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation.")), - mcp.WithString("body", mcp.Required(), mcp.Description("Input parameter: The text of the review comment.")), - mcp.WithString("commit_id", mcp.Required(), mcp.Description("Input parameter: The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the `position`.")), + mcp.WithString("path", mcp.Required(), mcp.Description("Input parameter: The relative path to the file that necessitates a comment.")), mcp.WithNumber("in_reply_to", mcp.Description("Input parameter: The ID of the review comment to reply to. To find the ID of a review comment with [\"List review comments on a pull request\"](#list-review-comments-on-a-pull-request). When specified, all parameters other than `body` in the request body are ignored.")), - mcp.WithNumber("position", mcp.Description("Input parameter: **This parameter is closing down. Use `line` instead**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. The position value equals the number of lines down from the first \"@@\" hunk header in the file you want to add a comment. The line just below the \"@@\" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.")), mcp.WithNumber("line", mcp.Description("Input parameter: **Required unless using `subject_type:file`**. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.")), - mcp.WithString("start_side", mcp.Description("Input parameter: **Required when using multi-line comments unless using `in_reply_to`**. The `start_side` is the starting side of the diff that the comment applies to. Can be `LEFT` or `RIGHT`. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation. See `side` in this table for additional context.")), + mcp.WithNumber("position", mcp.Description("Input parameter: **This parameter is closing down. Use `line` instead**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. The position value equals the number of lines down from the first \"@@\" hunk header in the file you want to add a comment. The line just below the \"@@\" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.")), + mcp.WithNumber("start_line", mcp.Description("Input parameter: **Required when using multi-line comments unless using `in_reply_to`**. The `start_line` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation.")), mcp.WithString("subject_type", mcp.Description("Input parameter: The level at which the comment is targeted.")), + mcp.WithString("commit_id", mcp.Required(), mcp.Description("Input parameter: The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the `position`.")), mcp.WithString("side", mcp.Description("Input parameter: In a split diff view, the side of the diff that the pull request's changes appear on. Can be `LEFT` or `RIGHT`. Use `LEFT` for deletions that appear in red. Use `RIGHT` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see \"[Diff view options](https://docs.github.com/articles/about-comparing-branches-in-pull-requests#diff-view-options)\" in the GitHub Help documentation.")), - mcp.WithString("path", mcp.Required(), mcp.Description("Input parameter: The relative path to the file that necessitates a comment.")), + mcp.WithString("start_side", mcp.Description("Input parameter: **Required when using multi-line comments unless using `in_reply_to`**. The `start_side` is the starting side of the diff that the comment applies to. Can be `LEFT` or `RIGHT`. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation. See `side` in this table for additional context.")), + mcp.WithString("body", mcp.Required(), mcp.Description("Input parameter: The text of the review comment.")), ) return models.Tool{ diff --git a/MCP/go/tools/pulls/pulls_delete_pending_review.go b/MCP/go/tools/pulls/pulls_delete_pending_review.go index cf07660..760f888 100644 --- a/MCP/go/tools/pulls/pulls_delete_pending_review.go +++ b/MCP/go/tools/pulls/pulls_delete_pending_review.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Pulls_delete_pending_reviewHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: review_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s%s", cfg.BaseURL, owner, repo, pull_number, review_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s", cfg.BaseURL, owner, repo, pull_number, review_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Pulls_delete_pending_reviewHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_delete_review_comment.go b/MCP/go/tools/pulls/pulls_delete_review_comment.go index 0be2928..b58e943 100644 --- a/MCP/go/tools/pulls/pulls_delete_review_comment.go +++ b/MCP/go/tools/pulls/pulls_delete_review_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Pulls_delete_review_commentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/pulls/pulls_dismiss_review.go b/MCP/go/tools/pulls/pulls_dismiss_review.go index 14a11d8..c82631b 100644 --- a/MCP/go/tools/pulls/pulls_dismiss_review.go +++ b/MCP/go/tools/pulls/pulls_dismiss_review.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Pulls_dismiss_reviewHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: review_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Pulls_dismiss_reviewHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s/dismissals%s", cfg.BaseURL, owner, repo, pull_number, review_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s/dismissals", cfg.BaseURL, owner, repo, pull_number, review_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Pulls_dismiss_reviewHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -151,14 +120,14 @@ func Pulls_dismiss_reviewHandler(cfg *config.APIConfig) func(ctx context.Context } func CreatePulls_dismiss_reviewTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_pulls_pull_number_reviews_review_id_dismissals", + tool := mcp.NewTool("put_repos_owner_repo_pulls_pull_number_reviews_review_id", mcp.WithDescription("Dismiss a review for a pull request"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("pull_number", mcp.Required(), mcp.Description("The number that identifies the pull request.")), mcp.WithNumber("review_id", mcp.Required(), mcp.Description("The unique identifier of the review.")), - mcp.WithString("event", mcp.Description("")), mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The message for the pull request review dismissal")), + mcp.WithString("event", mcp.Description("")), ) return models.Tool{ diff --git a/MCP/go/tools/pulls/pulls_get.go b/MCP/go/tools/pulls/pulls_get.go index e17545f..fa721b5 100644 --- a/MCP/go/tools/pulls/pulls_get.go +++ b/MCP/go/tools/pulls/pulls_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Pulls_getHandler(cfg *config.APIConfig) func(ctx context.Context, request m if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Pulls_getHandler(cfg *config.APIConfig) func(ctx context.Context, request m return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_get_review.go b/MCP/go/tools/pulls/pulls_get_review.go index fd44810..3edde3a 100644 --- a/MCP/go/tools/pulls/pulls_get_review.go +++ b/MCP/go/tools/pulls/pulls_get_review.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Pulls_get_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: review_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s%s", cfg.BaseURL, owner, repo, pull_number, review_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s", cfg.BaseURL, owner, repo, pull_number, review_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Pulls_get_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_get_review_comment.go b/MCP/go/tools/pulls/pulls_get_review_comment.go index 64d89df..cb6ceea 100644 --- a/MCP/go/tools/pulls/pulls_get_review_comment.go +++ b/MCP/go/tools/pulls/pulls_get_review_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Pulls_get_review_commentHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Pulls_get_review_commentHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list.go b/MCP/go/tools/pulls/pulls_list.go index c49847f..331a02c 100644 --- a/MCP/go/tools/pulls/pulls_list.go +++ b/MCP/go/tools/pulls/pulls_list.go @@ -57,34 +57,6 @@ func Pulls_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -94,17 +66,20 @@ func Pulls_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -122,7 +97,7 @@ func Pulls_listHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Pull_request_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list_comments_for_review.go b/MCP/go/tools/pulls/pulls_list_comments_for_review.go index 3cabff5..44ac2a3 100644 --- a/MCP/go/tools/pulls/pulls_list_comments_for_review.go +++ b/MCP/go/tools/pulls/pulls_list_comments_for_review.go @@ -58,34 +58,6 @@ func Pulls_list_comments_for_reviewHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -95,17 +67,20 @@ func Pulls_list_comments_for_reviewHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -123,7 +98,7 @@ func Pulls_list_comments_for_reviewHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,7 +114,7 @@ func Pulls_list_comments_for_reviewHandler(cfg *config.APIConfig) func(ctx conte } func CreatePulls_list_comments_for_reviewTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_pulls_pull_number_reviews_review_id_comments", + tool := mcp.NewTool("get_repos_owner_repo_pulls_pull_number_reviews_review_id", mcp.WithDescription("List comments for a pull request review"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/pulls/pulls_list_commits.go b/MCP/go/tools/pulls/pulls_list_commits.go index 2446760..472b8d4 100644 --- a/MCP/go/tools/pulls/pulls_list_commits.go +++ b/MCP/go/tools/pulls/pulls_list_commits.go @@ -50,34 +50,6 @@ func Pulls_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Pulls_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Pulls_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Commit + var result []models.Commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list_files.go b/MCP/go/tools/pulls/pulls_list_files.go index 067c1bb..fe127eb 100644 --- a/MCP/go/tools/pulls/pulls_list_files.go +++ b/MCP/go/tools/pulls/pulls_list_files.go @@ -50,34 +50,6 @@ func Pulls_list_filesHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Pulls_list_filesHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Pulls_list_filesHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Diff_entry if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list_requested_reviewers.go b/MCP/go/tools/pulls/pulls_list_requested_reviewers.go index ac03209..64c9992 100644 --- a/MCP/go/tools/pulls/pulls_list_requested_reviewers.go +++ b/MCP/go/tools/pulls/pulls_list_requested_reviewers.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Pulls_list_requested_reviewersHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/requested_reviewers%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/requested_reviewers", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Pulls_list_requested_reviewersHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review_request if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list_review_comments.go b/MCP/go/tools/pulls/pulls_list_review_comments.go index f6cb8d8..d1472b7 100644 --- a/MCP/go/tools/pulls/pulls_list_review_comments.go +++ b/MCP/go/tools/pulls/pulls_list_review_comments.go @@ -59,34 +59,6 @@ func Pulls_list_review_commentsHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -96,17 +68,20 @@ func Pulls_list_review_commentsHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -124,7 +99,7 @@ func Pulls_list_review_commentsHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Pull_request_review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list_review_comments_for_repo.go b/MCP/go/tools/pulls/pulls_list_review_comments_for_repo.go index 15170dc..c189cbc 100644 --- a/MCP/go/tools/pulls/pulls_list_review_comments_for_repo.go +++ b/MCP/go/tools/pulls/pulls_list_review_comments_for_repo.go @@ -51,34 +51,6 @@ func Pulls_list_review_comments_for_repoHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -88,17 +60,20 @@ func Pulls_list_review_comments_for_repoHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -116,7 +91,7 @@ func Pulls_list_review_comments_for_repoHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Pull_request_review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_list_reviews.go b/MCP/go/tools/pulls/pulls_list_reviews.go index f63e5e6..51f1333 100644 --- a/MCP/go/tools/pulls/pulls_list_reviews.go +++ b/MCP/go/tools/pulls/pulls_list_reviews.go @@ -50,34 +50,6 @@ func Pulls_list_reviewsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Pulls_list_reviewsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Pulls_list_reviewsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_merge.go b/MCP/go/tools/pulls/pulls_merge.go index 510c8fe..b0e979b 100644 --- a/MCP/go/tools/pulls/pulls_merge.go +++ b/MCP/go/tools/pulls/pulls_merge.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_mergeHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_mergeHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/merge%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/merge", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_mergeHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_merge_result if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,10 +117,10 @@ func CreatePulls_mergeTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("pull_number", mcp.Required(), mcp.Description("The number that identifies the pull request.")), + mcp.WithString("merge_method", mcp.Description("Input parameter: The merge method to use.")), mcp.WithString("sha", mcp.Description("Input parameter: SHA that pull request head must match to allow merge.")), mcp.WithString("commit_message", mcp.Description("Input parameter: Extra detail to append to automatic commit message.")), mcp.WithString("commit_title", mcp.Description("Input parameter: Title for the automatic commit message.")), - mcp.WithString("merge_method", mcp.Description("Input parameter: The merge method to use.")), ) return models.Tool{ diff --git a/MCP/go/tools/pulls/pulls_remove_requested_reviewers.go b/MCP/go/tools/pulls/pulls_remove_requested_reviewers.go index 55a3c02..f732cf3 100644 --- a/MCP/go/tools/pulls/pulls_remove_requested_reviewers.go +++ b/MCP/go/tools/pulls/pulls_remove_requested_reviewers.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_remove_requested_reviewersHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_remove_requested_reviewersHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/requested_reviewers%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/requested_reviewers", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_remove_requested_reviewersHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,13 +112,13 @@ func Pulls_remove_requested_reviewersHandler(cfg *config.APIConfig) func(ctx con } func CreatePulls_remove_requested_reviewersTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_pulls_pull_number_requested_reviewers", + tool := mcp.NewTool("delete_repos_owner_repo_pulls_pull_number_requested", mcp.WithDescription("Remove requested reviewers from a pull request"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("pull_number", mcp.Required(), mcp.Description("The number that identifies the pull request.")), - mcp.WithArray("team_reviewers", mcp.Description("Input parameter: An array of team `slug`s that will be removed.")), mcp.WithArray("reviewers", mcp.Required(), mcp.Description("Input parameter: An array of user `login`s that will be removed.")), + mcp.WithArray("team_reviewers", mcp.Description("Input parameter: An array of team `slug`s that will be removed.")), ) return models.Tool{ diff --git a/MCP/go/tools/pulls/pulls_request_reviewers.go b/MCP/go/tools/pulls/pulls_request_reviewers.go index 4f097a0..23f8634 100644 --- a/MCP/go/tools/pulls/pulls_request_reviewers.go +++ b/MCP/go/tools/pulls/pulls_request_reviewers.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_request_reviewersHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Pulls_request_reviewersHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/requested_reviewers%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/requested_reviewers", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_request_reviewersHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_submit_review.go b/MCP/go/tools/pulls/pulls_submit_review.go index 0c6e0db..1c21fa2 100644 --- a/MCP/go/tools/pulls/pulls_submit_review.go +++ b/MCP/go/tools/pulls/pulls_submit_review.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Pulls_submit_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: review_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Pulls_submit_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s/events%s", cfg.BaseURL, owner, repo, pull_number, review_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s/events", cfg.BaseURL, owner, repo, pull_number, review_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Pulls_submit_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -151,7 +120,7 @@ func Pulls_submit_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, } func CreatePulls_submit_reviewTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_pulls_pull_number_reviews_review_id_events", + tool := mcp.NewTool("post_repos_owner_repo_pulls_pull_number_reviews_review_id", mcp.WithDescription("Submit a review for a pull request"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/pulls/pulls_update.go b/MCP/go/tools/pulls/pulls_update.go index 29fe232..00146c9 100644 --- a/MCP/go/tools/pulls/pulls_update.go +++ b/MCP/go/tools/pulls/pulls_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,11 +117,11 @@ func CreatePulls_updateTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("pull_number", mcp.Required(), mcp.Description("The number that identifies the pull request.")), + mcp.WithString("base", mcp.Description("Input parameter: The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository.")), + mcp.WithString("body", mcp.Description("Input parameter: The contents of the pull request.")), mcp.WithBoolean("maintainer_can_modify", mcp.Description("Input parameter: Indicates whether [maintainers can modify](https://docs.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request.")), mcp.WithString("state", mcp.Description("Input parameter: State of this Pull Request. Either `open` or `closed`.")), mcp.WithString("title", mcp.Description("Input parameter: The title of the pull request.")), - mcp.WithString("base", mcp.Description("Input parameter: The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository.")), - mcp.WithString("body", mcp.Description("Input parameter: The contents of the pull request.")), ) return models.Tool{ diff --git a/MCP/go/tools/pulls/pulls_update_branch.go b/MCP/go/tools/pulls/pulls_update_branch.go index 230629a..c8de8a2 100644 --- a/MCP/go/tools/pulls/pulls_update_branch.go +++ b/MCP/go/tools/pulls/pulls_update_branch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_update_branchHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: pull_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_update_branchHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/update-branch%s", cfg.BaseURL, owner, repo, pull_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/update-branch", cfg.BaseURL, owner, repo, pull_number) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/pulls/pulls_update_review.go b/MCP/go/tools/pulls/pulls_update_review.go index 2224b82..b8a080e 100644 --- a/MCP/go/tools/pulls/pulls_update_review.go +++ b/MCP/go/tools/pulls/pulls_update_review.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Pulls_update_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: review_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Pulls_update_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s%s", cfg.BaseURL, owner, repo, pull_number, review_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/%s/reviews/%s", cfg.BaseURL, owner, repo, pull_number, review_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Pulls_update_reviewHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/pulls/pulls_update_review_comment.go b/MCP/go/tools/pulls/pulls_update_review_comment.go index 5b7c18b..5e58f8c 100644 --- a/MCP/go/tools/pulls/pulls_update_review_comment.go +++ b/MCP/go/tools/pulls/pulls_update_review_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Pulls_update_review_commentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Pulls_update_review_commentHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Pulls_update_review_commentHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pull_request_review_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/rate_limit/rate_limit_get.go b/MCP/go/tools/rate_limit/rate_limit_get.go index 152c6b4..b1b5d81 100644 --- a/MCP/go/tools/rate_limit/rate_limit_get.go +++ b/MCP/go/tools/rate_limit/rate_limit_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Rate_limit_getHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/rate_limit%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/rate_limit", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -81,7 +50,7 @@ func Rate_limit_getHandler(cfg *config.APIConfig) func(ctx context.Context, requ return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Rate_limit_overview if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/reactions/reactions_create_for_commit_comment.go b/MCP/go/tools/reactions/reactions_create_for_commit_comment.go index 0573d1a..0ac1ba1 100644 --- a/MCP/go/tools/reactions/reactions_create_for_commit_comment.go +++ b/MCP/go/tools/reactions/reactions_create_for_commit_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_commit_commentHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_commit_commentHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/comments/%s/reactions%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/comments/%s/reactions", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/reactions/reactions_create_for_issue.go b/MCP/go/tools/reactions/reactions_create_for_issue.go index 2eee4b8..7e82bef 100644 --- a/MCP/go/tools/reactions/reactions_create_for_issue.go +++ b/MCP/go/tools/reactions/reactions_create_for_issue.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_issueHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: issue_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_issueHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/reactions%s", cfg.BaseURL, owner, repo, issue_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/reactions", cfg.BaseURL, owner, repo, issue_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/reactions/reactions_create_for_issue_comment.go b/MCP/go/tools/reactions/reactions_create_for_issue_comment.go index f6d478a..dad269a 100644 --- a/MCP/go/tools/reactions/reactions_create_for_issue_comment.go +++ b/MCP/go/tools/reactions/reactions_create_for_issue_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_issue_commentHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_issue_commentHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s/reactions%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s/reactions", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/reactions/reactions_create_for_pull_request_review_comment.go b/MCP/go/tools/reactions/reactions_create_for_pull_request_review_comment.go index 67a86d9..5c5ef0d 100644 --- a/MCP/go/tools/reactions/reactions_create_for_pull_request_review_comment.go +++ b/MCP/go/tools/reactions/reactions_create_for_pull_request_review_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_pull_request_review_commentHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_pull_request_review_commentHandler(cfg *config.APIConf if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s/reactions%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s/reactions", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/reactions/reactions_create_for_release.go b/MCP/go/tools/reactions/reactions_create_for_release.go index 271a2c9..a81a58f 100644 --- a/MCP/go/tools/reactions/reactions_create_for_release.go +++ b/MCP/go/tools/reactions/reactions_create_for_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_releaseHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: release_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_releaseHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/releases/%s/reactions%s", cfg.BaseURL, owner, repo, release_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/%s/reactions", cfg.BaseURL, owner, repo, release_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_in_org.go b/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_in_org.go index 4d845a6..9b2b287 100644 --- a/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_in_org.go +++ b/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Reactions_create_for_team_discussion_comment_in_orgHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Reactions_create_for_team_discussion_comment_in_orgHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s/reactions%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s/reactions", cfg.BaseURL, org, team_slug, discussion_number, comment_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -151,7 +120,7 @@ func Reactions_create_for_team_discussion_comment_in_orgHandler(cfg *config.APIC } func CreateReactions_create_for_team_discussion_comment_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_teams_team_slug_discussions_discussion_number_comments_comment_number_reactions", + tool := mcp.NewTool("post_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("Create reaction for a team discussion comment"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_legacy.go b/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_legacy.go index 5125217..70a14ea 100644 --- a/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_legacy.go +++ b/MCP/go/tools/reactions/reactions_create_for_team_discussion_comment_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_team_discussion_comment_legacyHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_team_discussion_comment_legacyHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s/reactions%s", cfg.BaseURL, team_id, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s/reactions", cfg.BaseURL, team_id, discussion_number, comment_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Reactions_create_for_team_discussion_comment_legacyHandler(cfg *config.APIC } func CreateReactions_create_for_team_discussion_comment_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_teams_team_id_discussions_discussion_number_comments_comment_number_reactions", + tool := mcp.NewTool("post_teams_team_id_discussions_discussion_number_comments", mcp.WithDescription("Create reaction for a team discussion comment (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("discussion_number", mcp.Required(), mcp.Description("The number that identifies the discussion.")), diff --git a/MCP/go/tools/reactions/reactions_create_for_team_discussion_in_org.go b/MCP/go/tools/reactions/reactions_create_for_team_discussion_in_org.go index 5d7d73f..17a89ee 100644 --- a/MCP/go/tools/reactions/reactions_create_for_team_discussion_in_org.go +++ b/MCP/go/tools/reactions/reactions_create_for_team_discussion_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Reactions_create_for_team_discussion_in_orgHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Reactions_create_for_team_discussion_in_orgHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/reactions%s", cfg.BaseURL, org, team_slug, discussion_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/reactions", cfg.BaseURL, org, team_slug, discussion_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Reactions_create_for_team_discussion_in_orgHandler(cfg *config.APIConfig) f } func CreateReactions_create_for_team_discussion_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_teams_team_slug_discussions_discussion_number_reactions", + tool := mcp.NewTool("post_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("Create reaction for a team discussion"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/reactions/reactions_create_for_team_discussion_legacy.go b/MCP/go/tools/reactions/reactions_create_for_team_discussion_legacy.go index 37a8028..4ac0b09 100644 --- a/MCP/go/tools/reactions/reactions_create_for_team_discussion_legacy.go +++ b/MCP/go/tools/reactions/reactions_create_for_team_discussion_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Reactions_create_for_team_discussion_legacyHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Reactions_create_for_team_discussion_legacyHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/discussions/%s/reactions%s", cfg.BaseURL, team_id, discussion_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s/reactions", cfg.BaseURL, team_id, discussion_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/reactions/reactions_delete_for_commit_comment.go b/MCP/go/tools/reactions/reactions_delete_for_commit_comment.go index fc48d96..624277d 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_commit_comment.go +++ b/MCP/go/tools/reactions/reactions_delete_for_commit_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Reactions_delete_for_commit_commentHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/comments/%s/reactions/%s%s", cfg.BaseURL, owner, repo, comment_id, reaction_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/comments/%s/reactions/%s", cfg.BaseURL, owner, repo, comment_id, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Reactions_delete_for_commit_commentHandler(cfg *config.APIConfig) func(ctx } func CreateReactions_delete_for_commit_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_comments_comment_id_reactions_reaction_id", + tool := mcp.NewTool("delete_repos_owner_repo_comments_comment_id_reactions", mcp.WithDescription("Delete a commit comment reaction"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/reactions/reactions_delete_for_issue.go b/MCP/go/tools/reactions/reactions_delete_for_issue.go index 68eaa0f..6ec8d56 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_issue.go +++ b/MCP/go/tools/reactions/reactions_delete_for_issue.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Reactions_delete_for_issueHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/reactions/%s%s", cfg.BaseURL, owner, repo, issue_number, reaction_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/%s/reactions/%s", cfg.BaseURL, owner, repo, issue_number, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Reactions_delete_for_issueHandler(cfg *config.APIConfig) func(ctx context.C } func CreateReactions_delete_for_issueTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_issues_issue_number_reactions_reaction_id", + tool := mcp.NewTool("delete_repos_owner_repo_issues_issue_number_reactions", mcp.WithDescription("Delete an issue reaction"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/reactions/reactions_delete_for_issue_comment.go b/MCP/go/tools/reactions/reactions_delete_for_issue_comment.go index d191621..f6f4bab 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_issue_comment.go +++ b/MCP/go/tools/reactions/reactions_delete_for_issue_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Reactions_delete_for_issue_commentHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s/reactions/%s%s", cfg.BaseURL, owner, repo, comment_id, reaction_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/issues/comments/%s/reactions/%s", cfg.BaseURL, owner, repo, comment_id, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Reactions_delete_for_issue_commentHandler(cfg *config.APIConfig) func(ctx c } func CreateReactions_delete_for_issue_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_issues_comments_comment_id_reactions_reaction_id", + tool := mcp.NewTool("delete_repos_owner_repo_issues_comments_comment_id_reactions", mcp.WithDescription("Delete an issue comment reaction"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/reactions/reactions_delete_for_pull_request_comment.go b/MCP/go/tools/reactions/reactions_delete_for_pull_request_comment.go index 8ecf2dc..9b56a10 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_pull_request_comment.go +++ b/MCP/go/tools/reactions/reactions_delete_for_pull_request_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Reactions_delete_for_pull_request_commentHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s/reactions/%s%s", cfg.BaseURL, owner, repo, comment_id, reaction_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pulls/comments/%s/reactions/%s", cfg.BaseURL, owner, repo, comment_id, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Reactions_delete_for_pull_request_commentHandler(cfg *config.APIConfig) fun } func CreateReactions_delete_for_pull_request_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_pulls_comments_comment_id_reactions_reaction_id", + tool := mcp.NewTool("delete_repos_owner_repo_pulls_comments_comment_id_reactions", mcp.WithDescription("Delete a pull request comment reaction"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/reactions/reactions_delete_for_release.go b/MCP/go/tools/reactions/reactions_delete_for_release.go index 673be45..418a314 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_release.go +++ b/MCP/go/tools/reactions/reactions_delete_for_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Reactions_delete_for_releaseHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/%s/reactions/%s%s", cfg.BaseURL, owner, repo, release_id, reaction_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/%s/reactions/%s", cfg.BaseURL, owner, repo, release_id, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Reactions_delete_for_releaseHandler(cfg *config.APIConfig) func(ctx context } func CreateReactions_delete_for_releaseTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_releases_release_id_reactions_reaction_id", + tool := mcp.NewTool("delete_repos_owner_repo_releases_release_id_reactions", mcp.WithDescription("Delete a release reaction"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/reactions/reactions_delete_for_team_discussion.go b/MCP/go/tools/reactions/reactions_delete_for_team_discussion.go index 6d96d91..b6092eb 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_team_discussion.go +++ b/MCP/go/tools/reactions/reactions_delete_for_team_discussion.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Reactions_delete_for_team_discussionHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/reactions/%s%s", cfg.BaseURL, org, team_slug, discussion_number, reaction_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/reactions/%s", cfg.BaseURL, org, team_slug, discussion_number, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Reactions_delete_for_team_discussionHandler(cfg *config.APIConfig) func(ctx } func CreateReactions_delete_for_team_discussionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion_number_reactions_reaction_id", + tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion", mcp.WithDescription("Delete team discussion reaction"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/reactions/reactions_delete_for_team_discussion_comment.go b/MCP/go/tools/reactions/reactions_delete_for_team_discussion_comment.go index 085954e..8cf3c11 100644 --- a/MCP/go/tools/reactions/reactions_delete_for_team_discussion_comment.go +++ b/MCP/go/tools/reactions/reactions_delete_for_team_discussion_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -59,55 +58,25 @@ func Reactions_delete_for_team_discussion_commentHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: reaction_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s/reactions/%s%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number, reaction_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s/reactions/%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number, reaction_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -141,7 +110,7 @@ func Reactions_delete_for_team_discussion_commentHandler(cfg *config.APIConfig) } func CreateReactions_delete_for_team_discussion_commentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion_number_comments_comment_number_reactions_reaction_id", + tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion", mcp.WithDescription("Delete team discussion comment reaction"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/reactions/reactions_list_for_commit_comment.go b/MCP/go/tools/reactions/reactions_list_for_commit_comment.go index 5acc945..250042e 100644 --- a/MCP/go/tools/reactions/reactions_list_for_commit_comment.go +++ b/MCP/go/tools/reactions/reactions_list_for_commit_comment.go @@ -53,34 +53,6 @@ func Reactions_list_for_commit_commentHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_commit_commentHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_commit_commentHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/reactions/reactions_list_for_issue.go b/MCP/go/tools/reactions/reactions_list_for_issue.go index c7d4cd2..618e9a5 100644 --- a/MCP/go/tools/reactions/reactions_list_for_issue.go +++ b/MCP/go/tools/reactions/reactions_list_for_issue.go @@ -53,34 +53,6 @@ func Reactions_list_for_issueHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_issueHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_issueHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/reactions/reactions_list_for_issue_comment.go b/MCP/go/tools/reactions/reactions_list_for_issue_comment.go index 7cde2db..b59d5bc 100644 --- a/MCP/go/tools/reactions/reactions_list_for_issue_comment.go +++ b/MCP/go/tools/reactions/reactions_list_for_issue_comment.go @@ -53,34 +53,6 @@ func Reactions_list_for_issue_commentHandler(cfg *config.APIConfig) func(ctx con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_issue_commentHandler(cfg *config.APIConfig) func(ctx con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_issue_commentHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/reactions/reactions_list_for_pull_request_review_comment.go b/MCP/go/tools/reactions/reactions_list_for_pull_request_review_comment.go index 05d915a..9efbc94 100644 --- a/MCP/go/tools/reactions/reactions_list_for_pull_request_review_comment.go +++ b/MCP/go/tools/reactions/reactions_list_for_pull_request_review_comment.go @@ -53,34 +53,6 @@ func Reactions_list_for_pull_request_review_commentHandler(cfg *config.APIConfig if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_pull_request_review_commentHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_pull_request_review_commentHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/reactions/reactions_list_for_release.go b/MCP/go/tools/reactions/reactions_list_for_release.go index a052e9b..11a47d3 100644 --- a/MCP/go/tools/reactions/reactions_list_for_release.go +++ b/MCP/go/tools/reactions/reactions_list_for_release.go @@ -53,34 +53,6 @@ func Reactions_list_for_releaseHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_releaseHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_releaseHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_in_org.go b/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_in_org.go index b8e8b01..bad8c76 100644 --- a/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_in_org.go +++ b/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_in_org.go @@ -61,34 +61,6 @@ func Reactions_list_for_team_discussion_comment_in_orgHandler(cfg *config.APICon if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -98,17 +70,20 @@ func Reactions_list_for_team_discussion_comment_in_orgHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -126,7 +101,7 @@ func Reactions_list_for_team_discussion_comment_in_orgHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -142,7 +117,7 @@ func Reactions_list_for_team_discussion_comment_in_orgHandler(cfg *config.APICon } func CreateReactions_list_for_team_discussion_comment_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number_comments_comment_number_reactions", + tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("List reactions for a team discussion comment"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_legacy.go b/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_legacy.go index 151fb5f..fd332b8 100644 --- a/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_legacy.go +++ b/MCP/go/tools/reactions/reactions_list_for_team_discussion_comment_legacy.go @@ -53,34 +53,6 @@ func Reactions_list_for_team_discussion_comment_legacyHandler(cfg *config.APICon if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_team_discussion_comment_legacyHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_team_discussion_comment_legacyHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -134,7 +109,7 @@ func Reactions_list_for_team_discussion_comment_legacyHandler(cfg *config.APICon } func CreateReactions_list_for_team_discussion_comment_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_teams_team_id_discussions_discussion_number_comments_comment_number_reactions", + tool := mcp.NewTool("get_teams_team_id_discussions_discussion_number_comments", mcp.WithDescription("List reactions for a team discussion comment (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("discussion_number", mcp.Required(), mcp.Description("The number that identifies the discussion.")), diff --git a/MCP/go/tools/reactions/reactions_list_for_team_discussion_in_org.go b/MCP/go/tools/reactions/reactions_list_for_team_discussion_in_org.go index 8b01317..24a35d5 100644 --- a/MCP/go/tools/reactions/reactions_list_for_team_discussion_in_org.go +++ b/MCP/go/tools/reactions/reactions_list_for_team_discussion_in_org.go @@ -53,34 +53,6 @@ func Reactions_list_for_team_discussion_in_orgHandler(cfg *config.APIConfig) fun if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Reactions_list_for_team_discussion_in_orgHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Reactions_list_for_team_discussion_in_orgHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -134,7 +109,7 @@ func Reactions_list_for_team_discussion_in_orgHandler(cfg *config.APIConfig) fun } func CreateReactions_list_for_team_discussion_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number_reactions", + tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("List reactions for a team discussion"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/reactions/reactions_list_for_team_discussion_legacy.go b/MCP/go/tools/reactions/reactions_list_for_team_discussion_legacy.go index 99a4c95..6bf8f39 100644 --- a/MCP/go/tools/reactions/reactions_list_for_team_discussion_legacy.go +++ b/MCP/go/tools/reactions/reactions_list_for_team_discussion_legacy.go @@ -45,34 +45,6 @@ func Reactions_list_for_team_discussion_legacyHandler(cfg *config.APIConfig) fun if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Reactions_list_for_team_discussion_legacyHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Reactions_list_for_team_discussion_legacyHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Reaction + var result []models.Reaction if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_accept_invitation_for_authenticated_user.go b/MCP/go/tools/repos/repos_accept_invitation_for_authenticated_user.go index 40bd253..48a54ea 100644 --- a/MCP/go/tools/repos/repos_accept_invitation_for_authenticated_user.go +++ b/MCP/go/tools/repos/repos_accept_invitation_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Repos_accept_invitation_for_authenticated_userHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: invitation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/repository_invitations/%s%s", cfg.BaseURL, invitation_id, queryString) + url := fmt.Sprintf("%s/user/repository_invitations/%s", cfg.BaseURL, invitation_id) req, err := http.NewRequest("PATCH", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_add_app_access_restrictions.go b/MCP/go/tools/repos/repos_add_app_access_restrictions.go index f693cb3..90cf1f2 100644 --- a/MCP/go/tools/repos/repos_add_app_access_restrictions.go +++ b/MCP/go/tools/repos/repos_add_app_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_add_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_add_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_add_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Integration + var result []models.Integration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_add_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co } func CreateRepos_add_app_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_restrictions_apps", + tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Add app access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_add_collaborator.go b/MCP/go/tools/repos/repos_add_collaborator.go index 8c69fe0..ee1d79b 100644 --- a/MCP/go/tools/repos/repos_add_collaborator.go +++ b/MCP/go/tools/repos/repos_add_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_add_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Conte if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_add_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s%s", cfg.BaseURL, owner, repo, username, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s", cfg.BaseURL, owner, repo, username) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_add_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_add_status_check_contexts.go b/MCP/go/tools/repos/repos_add_status_check_contexts.go index ceaa01b..c6e0e1e 100644 --- a/MCP/go/tools/repos/repos_add_status_check_contexts.go +++ b/MCP/go/tools/repos/repos_add_status_check_contexts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_add_status_check_contextsHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Repos_add_status_check_contextsHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Repos_add_status_check_contextsHandler(cfg *config.APIConfig) func(ctx cont } func CreateRepos_add_status_check_contextsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_required_status_checks_contexts", + tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Add status check contexts"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_add_team_access_restrictions.go b/MCP/go/tools/repos/repos_add_team_access_restrictions.go index d7eab34..f5de45b 100644 --- a/MCP/go/tools/repos/repos_add_team_access_restrictions.go +++ b/MCP/go/tools/repos/repos_add_team_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_add_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Repos_add_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_add_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_add_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_add_team_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_restrictions_teams", + tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Add team access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_add_user_access_restrictions.go b/MCP/go/tools/repos/repos_add_user_access_restrictions.go index bfabd5c..4178c8b 100644 --- a/MCP/go/tools/repos/repos_add_user_access_restrictions.go +++ b/MCP/go/tools/repos/repos_add_user_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_add_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_add_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_add_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_add_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_add_user_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_restrictions_users", + tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Add user access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_cancel_pages_deployment.go b/MCP/go/tools/repos/repos_cancel_pages_deployment.go index 97da33e..36de051 100644 --- a/MCP/go/tools/repos/repos_cancel_pages_deployment.go +++ b/MCP/go/tools/repos/repos_cancel_pages_deployment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_cancel_pages_deploymentHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: pages_deployment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages/deployments/%s/cancel%s", cfg.BaseURL, owner, repo, pages_deployment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/deployments/%s/cancel", cfg.BaseURL, owner, repo, pages_deployment_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_cancel_pages_deploymentHandler(cfg *config.APIConfig) func(ctx contex } func CreateRepos_cancel_pages_deploymentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_pages_deployments_pages_deployment_id_cancel", + tool := mcp.NewTool("post_repos_owner_repo_pages_deployments_deployment_id_cancel", mcp.WithDescription("Cancel a GitHub Pages deployment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_check_automated_security_fixes.go b/MCP/go/tools/repos/repos_check_automated_security_fixes.go index 488a6ef..c9d3011 100644 --- a/MCP/go/tools/repos/repos_check_automated_security_fixes.go +++ b/MCP/go/tools/repos/repos_check_automated_security_fixes.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_check_automated_security_fixesHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/automated-security-fixes%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/automated-security-fixes", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_check_automated_security_fixesHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Check_automated_security_fixes if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_check_collaborator.go b/MCP/go/tools/repos/repos_check_collaborator.go index c5f7ce2..9e44579 100644 --- a/MCP/go/tools/repos/repos_check_collaborator.go +++ b/MCP/go/tools/repos/repos_check_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_check_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s%s", cfg.BaseURL, owner, repo, username, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s", cfg.BaseURL, owner, repo, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_check_private_vulnerability_reporting.go b/MCP/go/tools/repos/repos_check_private_vulnerability_reporting.go index b0b3bc0..eba31f8 100644 --- a/MCP/go/tools/repos/repos_check_private_vulnerability_reporting.go +++ b/MCP/go/tools/repos/repos_check_private_vulnerability_reporting.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_check_private_vulnerability_reportingHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/private-vulnerability-reporting%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/private-vulnerability-reporting", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_check_vulnerability_alerts.go b/MCP/go/tools/repos/repos_check_vulnerability_alerts.go index 1da492a..6807b18 100644 --- a/MCP/go/tools/repos/repos_check_vulnerability_alerts.go +++ b/MCP/go/tools/repos/repos_check_vulnerability_alerts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_check_vulnerability_alertsHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/vulnerability-alerts%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/vulnerability-alerts", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_codeowners_errors.go b/MCP/go/tools/repos/repos_codeowners_errors.go index 17a022e..622a047 100644 --- a/MCP/go/tools/repos/repos_codeowners_errors.go +++ b/MCP/go/tools/repos/repos_codeowners_errors.go @@ -39,34 +39,6 @@ func Repos_codeowners_errorsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Repos_codeowners_errorsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -104,7 +79,7 @@ func Repos_codeowners_errorsHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Codeowners_errors if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_compare_commits.go b/MCP/go/tools/repos/repos_compare_commits.go index a719a88..17c72c1 100644 --- a/MCP/go/tools/repos/repos_compare_commits.go +++ b/MCP/go/tools/repos/repos_compare_commits.go @@ -50,34 +50,6 @@ func Repos_compare_commitsHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_compare_commitsHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_compare_commitsHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Commit_comparison if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_create_attestation.go b/MCP/go/tools/repos/repos_create_attestation.go index 07966dc..4ed1a61 100644 --- a/MCP/go/tools/repos/repos_create_attestation.go +++ b/MCP/go/tools/repos/repos_create_attestation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_attestationHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_attestationHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/attestations%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/attestations", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_create_autolink.go b/MCP/go/tools/repos/repos_create_autolink.go index 557ed2d..b204550 100644 --- a/MCP/go/tools/repos/repos_create_autolink.go +++ b/MCP/go/tools/repos/repos_create_autolink.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_autolinkHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_autolinkHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/autolinks%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/autolinks", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,9 +108,9 @@ func CreateRepos_create_autolinkTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create an autolink reference for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("url_template", mcp.Required(), mcp.Description("Input parameter: The URL must contain `` for the reference number. `` matches different characters depending on the value of `is_alphanumeric`.")), mcp.WithBoolean("is_alphanumeric", mcp.Description("Input parameter: Whether this autolink reference matches alphanumeric characters. If true, the `` parameter of the `url_template` matches alphanumeric characters `A-Z` (case insensitive), `0-9`, and `-`. If false, this autolink reference only matches numeric characters.")), mcp.WithString("key_prefix", mcp.Required(), mcp.Description("Input parameter: This prefix appended by certain characters will generate a link any time it is found in an issue, pull request, or commit.")), + mcp.WithString("url_template", mcp.Required(), mcp.Description("Input parameter: The URL must contain `` for the reference number. `` matches different characters depending on the value of `is_alphanumeric`.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_commit_comment.go b/MCP/go/tools/repos/repos_create_commit_comment.go index d5bdfee..2a4f48b 100644 --- a/MCP/go/tools/repos/repos_create_commit_comment.go +++ b/MCP/go/tools/repos/repos_create_commit_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_create_commit_commentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: commit_sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_create_commit_commentHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/commits/%s/comments%s", cfg.BaseURL, owner, repo, commit_sha, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/commits/%s/comments", cfg.BaseURL, owner, repo, commit_sha) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_create_commit_commentHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Commit_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,10 +117,10 @@ func CreateRepos_create_commit_commentTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("commit_sha", mcp.Required(), mcp.Description("The SHA of the commit.")), - mcp.WithString("path", mcp.Description("Input parameter: Relative path of the file to comment on.")), - mcp.WithNumber("position", mcp.Description("Input parameter: Line index in the diff to comment on.")), mcp.WithString("body", mcp.Required(), mcp.Description("Input parameter: The contents of the comment.")), mcp.WithNumber("line", mcp.Description("Input parameter: **Closing down notice**. Use **position** parameter instead. Line number in the file to comment on.")), + mcp.WithString("path", mcp.Description("Input parameter: Relative path of the file to comment on.")), + mcp.WithNumber("position", mcp.Description("Input parameter: Line index in the diff to comment on.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_commit_signature_protection.go b/MCP/go/tools/repos/repos_create_commit_signature_protection.go index 3d2db6c..857d9da 100644 --- a/MCP/go/tools/repos/repos_create_commit_signature_protection.go +++ b/MCP/go/tools/repos/repos_create_commit_signature_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_create_commit_signature_protectionHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_signatures%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_signatures", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_create_commit_signature_protectionHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch_admin_enforced if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_create_commit_signature_protectionHandler(cfg *config.APIConfig) func } func CreateRepos_create_commit_signature_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_required_signatures", + tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Create commit signature protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_create_commit_status.go b/MCP/go/tools/repos/repos_create_commit_status.go index d527ccd..d468026 100644 --- a/MCP/go/tools/repos/repos_create_commit_status.go +++ b/MCP/go/tools/repos/repos_create_commit_status.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_create_commit_statusHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_create_commit_statusHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/statuses/%s%s", cfg.BaseURL, owner, repo, sha, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/statuses/%s", cfg.BaseURL, owner, repo, sha) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -148,10 +117,10 @@ func CreateRepos_create_commit_statusTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("sha", mcp.Required(), mcp.Description("")), - mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: The state of the status.")), - mcp.WithString("target_url", mcp.Description("Input parameter: The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status. \nFor example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA: \n`http://ci.example.com/user/repo/build/sha`")), mcp.WithString("context", mcp.Description("Input parameter: A string label to differentiate this status from the status of other systems. This field is case-insensitive.")), mcp.WithString("description", mcp.Description("Input parameter: A short description of the status.")), + mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: The state of the status.")), + mcp.WithString("target_url", mcp.Description("Input parameter: The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status. \nFor example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA: \n`http://ci.example.com/user/repo/build/sha`")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_deploy_key.go b/MCP/go/tools/repos/repos_create_deploy_key.go index d135d8a..5c25bcd 100644 --- a/MCP/go/tools/repos/repos_create_deploy_key.go +++ b/MCP/go/tools/repos/repos_create_deploy_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_deploy_keyHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_deploy_keyHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/keys%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/keys", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_create_deploy_keyHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deploy_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_create_deployment.go b/MCP/go/tools/repos/repos_create_deployment.go index 12b1a3e..8757875 100644 --- a/MCP/go/tools/repos/repos_create_deployment.go +++ b/MCP/go/tools/repos/repos_create_deployment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_deploymentHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_deploymentHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/deployments%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/deployments", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,14 +108,14 @@ func CreateRepos_create_deploymentTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a deployment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("environment", mcp.Description("Input parameter: Name for the target deployment environment (e.g., `production`, `staging`, `qa`).")), - mcp.WithObject("payload", mcp.Description("")), + mcp.WithString("task", mcp.Description("Input parameter: Specifies a task to execute (e.g., `deploy` or `deploy:migrations`).")), mcp.WithString("ref", mcp.Required(), mcp.Description("Input parameter: The ref to deploy. This can be a branch, tag, or SHA.")), - mcp.WithBoolean("transient_environment", mcp.Description("Input parameter: Specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: `false`")), - mcp.WithBoolean("production_environment", mcp.Description("Input parameter: Specifies if the given environment is one that end-users directly interact with. Default: `true` when `environment` is `production` and `false` otherwise.")), mcp.WithArray("required_contexts", mcp.Description("Input parameter: The [status](https://docs.github.com/rest/commits/statuses) contexts to verify against commit status checks. If you omit this parameter, GitHub verifies all unique contexts before creating a deployment. To bypass checking entirely, pass an empty array. Defaults to all unique contexts.")), - mcp.WithString("task", mcp.Description("Input parameter: Specifies a task to execute (e.g., `deploy` or `deploy:migrations`).")), + mcp.WithBoolean("production_environment", mcp.Description("Input parameter: Specifies if the given environment is one that end-users directly interact with. Default: `true` when `environment` is `production` and `false` otherwise.")), mcp.WithBoolean("auto_merge", mcp.Description("Input parameter: Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch.")), + mcp.WithString("environment", mcp.Description("Input parameter: Name for the target deployment environment (e.g., `production`, `staging`, `qa`).")), + mcp.WithObject("payload", mcp.Description("")), + mcp.WithBoolean("transient_environment", mcp.Description("Input parameter: Specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: `false`")), mcp.WithString("description", mcp.Description("Input parameter: Short description of the deployment.")), ) diff --git a/MCP/go/tools/repos/repos_create_deployment_branch_policy.go b/MCP/go/tools/repos/repos_create_deployment_branch_policy.go index 27783e8..6a41081 100644 --- a/MCP/go/tools/repos/repos_create_deployment_branch_policy.go +++ b/MCP/go/tools/repos/repos_create_deployment_branch_policy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,41 +43,8 @@ func Repos_create_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Deployment_branch_policy_name_pattern_with_type // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -93,23 +59,26 @@ func Repos_create_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies%s", cfg.BaseURL, owner, repo, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies", cfg.BaseURL, owner, repo, environment_name) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_create_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_branch_policy if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,13 +112,13 @@ func Repos_create_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct } func CreateRepos_create_deployment_branch_policyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_environments_environment_name_deployment-branch-policies", + tool := mcp.NewTool("post_repos_owner_repo_environments_environment_name", mcp.WithDescription("Create a deployment branch policy"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name pattern that branches or tags must match in order to deploy to the environment.\n\nWildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`.\nFor more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch).")), mcp.WithString("type", mcp.Description("Input parameter: Whether this rule targets a branch or tag")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name pattern that branches or tags must match in order to deploy to the environment.\n\nWildcard characters will not match `/`. For example, to match branches that begin with `release/` and contain an additional single slash, use `release/*/*`.\nFor more information about pattern matching syntax, see the [Ruby File.fnmatch documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch).")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_deployment_protection_rule.go b/MCP/go/tools/repos/repos_create_deployment_protection_rule.go index 163af35..791a1dc 100644 --- a/MCP/go/tools/repos/repos_create_deployment_protection_rule.go +++ b/MCP/go/tools/repos/repos_create_deployment_protection_rule.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_create_deployment_protection_ruleHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: owner"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_create_deployment_protection_ruleHandler(cfg *config.APIConfig) func( if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules%s", cfg.BaseURL, environment_name, repo, owner, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules", cfg.BaseURL, environment_name, repo, owner) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_create_deployment_protection_ruleHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_protection_rule if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_create_deployment_protection_ruleHandler(cfg *config.APIConfig) func( } func CreateRepos_create_deployment_protection_ruleTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_environments_environment_name_deployment_protection_rules", + tool := mcp.NewTool("post_repos_owner_repo_environments_environment_name", mcp.WithDescription("Create a custom deployment protection rule on an environment"), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_create_deployment_status.go b/MCP/go/tools/repos/repos_create_deployment_status.go index 4914232..dc31878 100644 --- a/MCP/go/tools/repos/repos_create_deployment_status.go +++ b/MCP/go/tools/repos/repos_create_deployment_status.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_create_deployment_statusHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: deployment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_create_deployment_statusHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s/statuses%s", cfg.BaseURL, owner, repo, deployment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s/statuses", cfg.BaseURL, owner, repo, deployment_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_create_deployment_statusHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,13 +117,13 @@ func CreateRepos_create_deployment_statusTool(cfg *config.APIConfig) models.Tool mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("deployment_id", mcp.Required(), mcp.Description("deployment_id parameter")), - mcp.WithBoolean("auto_inactive", mcp.Description("Input parameter: Adds a new `inactive` status to all prior non-transient, non-production environment deployments with the same repository and `environment` name as the created status's deployment. An `inactive` status is only added to deployments that had a `success` state. Default: `true`")), - mcp.WithString("description", mcp.Description("Input parameter: A short description of the status. The maximum description length is 140 characters.")), mcp.WithString("environment", mcp.Description("Input parameter: Name for the target deployment environment, which can be changed when setting a deploy status. For example, `production`, `staging`, or `qa`. If not defined, the environment of the previous status on the deployment will be used, if it exists. Otherwise, the environment of the deployment will be used.")), mcp.WithString("environment_url", mcp.Description("Input parameter: Sets the URL for accessing your environment. Default: `\"\"`")), mcp.WithString("log_url", mcp.Description("Input parameter: The full URL of the deployment's output. This parameter replaces `target_url`. We will continue to accept `target_url` to support legacy uses, but we recommend replacing `target_url` with `log_url`. Setting `log_url` will automatically set `target_url` to the same value. Default: `\"\"`")), mcp.WithString("state", mcp.Required(), mcp.Description("Input parameter: The state of the status. When you set a transient deployment to `inactive`, the deployment will be shown as `destroyed` in GitHub.")), mcp.WithString("target_url", mcp.Description("Input parameter: The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment.\n\n> [!NOTE]\n> It's recommended to use the `log_url` parameter, which replaces `target_url`.")), + mcp.WithBoolean("auto_inactive", mcp.Description("Input parameter: Adds a new `inactive` status to all prior non-transient, non-production environment deployments with the same repository and `environment` name as the created status's deployment. An `inactive` status is only added to deployments that had a `success` state. Default: `true`")), + mcp.WithString("description", mcp.Description("Input parameter: A short description of the status. The maximum description length is 140 characters.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_dispatch_event.go b/MCP/go/tools/repos/repos_create_dispatch_event.go index b64d545..2bc9438 100644 --- a/MCP/go/tools/repos/repos_create_dispatch_event.go +++ b/MCP/go/tools/repos/repos_create_dispatch_event.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_dispatch_eventHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_dispatch_eventHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/dispatches%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/dispatches", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_create_for_authenticated_user.go b/MCP/go/tools/repos/repos_create_for_authenticated_user.go index 82ded8f..d6de72b 100644 --- a/MCP/go/tools/repos/repos_create_for_authenticated_user.go +++ b/MCP/go/tools/repos/repos_create_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Repos_create_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Repos_create_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/repos%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/repos", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Repos_create_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Full_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -121,29 +90,29 @@ func Repos_create_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx func CreateRepos_create_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_user_repos", mcp.WithDescription("Create a repository for the authenticated user"), + mcp.WithBoolean("allow_rebase_merge", mcp.Description("Input parameter: Whether to allow rebase merges for pull requests.")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the repository.")), + mcp.WithBoolean("allow_merge_commit", mcp.Description("Input parameter: Whether to allow merge commits for pull requests.")), mcp.WithBoolean("auto_init", mcp.Description("Input parameter: Whether the repository is initialized with a minimal README.")), - mcp.WithBoolean("delete_branch_on_merge", mcp.Description("Input parameter: Whether to delete head branches when pull requests are merged")), + mcp.WithNumber("team_id", mcp.Description("Input parameter: The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.")), + mcp.WithBoolean("has_projects", mcp.Description("Input parameter: Whether projects are enabled.")), + mcp.WithBoolean("allow_squash_merge", mcp.Description("Input parameter: Whether to allow squash merges for pull requests.")), mcp.WithBoolean("has_downloads", mcp.Description("Input parameter: Whether downloads are enabled.")), - mcp.WithString("homepage", mcp.Description("Input parameter: A URL with more information about the repository.")), - mcp.WithBoolean("is_template", mcp.Description("Input parameter: Whether this repository acts as a template that can be used to generate new repositories.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the repository.")), - mcp.WithBoolean("has_wiki", mcp.Description("Input parameter: Whether the wiki is enabled.")), mcp.WithString("squash_merge_commit_message", mcp.Description("Input parameter: The default value for a squash merge commit message:\n\n- `PR_BODY` - default to the pull request's body.\n- `COMMIT_MESSAGES` - default to the branch's commit messages.\n- `BLANK` - default to a blank commit message.")), - mcp.WithString("squash_merge_commit_title", mcp.Description("Input parameter: Required when using `squash_merge_commit_message`.\n\nThe default value for a squash merge commit title:\n\n- `PR_TITLE` - default to the pull request's title.\n- `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).")), - mcp.WithBoolean("allow_rebase_merge", mcp.Description("Input parameter: Whether to allow rebase merges for pull requests.")), - mcp.WithString("merge_commit_title", mcp.Description("Input parameter: Required when using `merge_commit_message`.\n\nThe default value for a merge commit title.\n\n- `PR_TITLE` - default to the pull request's title.\n- `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).")), - mcp.WithBoolean("private", mcp.Description("Input parameter: Whether the repository is private.")), - mcp.WithBoolean("has_discussions", mcp.Description("Input parameter: Whether discussions are enabled.")), + mcp.WithBoolean("has_wiki", mcp.Description("Input parameter: Whether the wiki is enabled.")), mcp.WithString("merge_commit_message", mcp.Description("Input parameter: The default value for a merge commit message.\n\n- `PR_TITLE` - default to the pull request's title.\n- `PR_BODY` - default to the pull request's body.\n- `BLANK` - default to a blank commit message.")), - mcp.WithBoolean("allow_auto_merge", mcp.Description("Input parameter: Whether to allow Auto-merge to be used on pull requests.")), + mcp.WithBoolean("has_issues", mcp.Description("Input parameter: Whether issues are enabled.")), + mcp.WithString("homepage", mcp.Description("Input parameter: A URL with more information about the repository.")), + mcp.WithBoolean("private", mcp.Description("Input parameter: Whether the repository is private.")), mcp.WithString("description", mcp.Description("Input parameter: A short description of the repository.")), - mcp.WithString("gitignore_template", mcp.Description("Input parameter: The desired language or platform to apply to the .gitignore.")), + mcp.WithBoolean("allow_auto_merge", mcp.Description("Input parameter: Whether to allow Auto-merge to be used on pull requests.")), + mcp.WithString("squash_merge_commit_title", mcp.Description("Input parameter: Required when using `squash_merge_commit_message`.\n\nThe default value for a squash merge commit title:\n\n- `PR_TITLE` - default to the pull request's title.\n- `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).")), + mcp.WithBoolean("delete_branch_on_merge", mcp.Description("Input parameter: Whether to delete head branches when pull requests are merged")), + mcp.WithString("merge_commit_title", mcp.Description("Input parameter: Required when using `merge_commit_message`.\n\nThe default value for a merge commit title.\n\n- `PR_TITLE` - default to the pull request's title.\n- `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).")), + mcp.WithBoolean("is_template", mcp.Description("Input parameter: Whether this repository acts as a template that can be used to generate new repositories.")), mcp.WithString("license_template", mcp.Description("Input parameter: The license keyword of the open source license for this repository.")), - mcp.WithBoolean("has_projects", mcp.Description("Input parameter: Whether projects are enabled.")), - mcp.WithBoolean("allow_squash_merge", mcp.Description("Input parameter: Whether to allow squash merges for pull requests.")), - mcp.WithBoolean("allow_merge_commit", mcp.Description("Input parameter: Whether to allow merge commits for pull requests.")), - mcp.WithBoolean("has_issues", mcp.Description("Input parameter: Whether issues are enabled.")), - mcp.WithNumber("team_id", mcp.Description("Input parameter: The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.")), + mcp.WithString("gitignore_template", mcp.Description("Input parameter: The desired language or platform to apply to the .gitignore.")), + mcp.WithBoolean("has_discussions", mcp.Description("Input parameter: Whether discussions are enabled.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_fork.go b/MCP/go/tools/repos/repos_create_fork.go index 46ecf7d..afe4103 100644 --- a/MCP/go/tools/repos/repos_create_fork.go +++ b/MCP/go/tools/repos/repos_create_fork.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_forkHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_forkHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/forks%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/forks", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,9 +108,9 @@ func CreateRepos_create_forkTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a fork"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithBoolean("default_branch_only", mcp.Description("Input parameter: When forking from an existing repository, fork with only the default branch.")), mcp.WithString("name", mcp.Description("Input parameter: When forking from an existing repository, a new name for the fork.")), mcp.WithString("organization", mcp.Description("Input parameter: Optional parameter to specify the organization name if forking into an organization.")), - mcp.WithBoolean("default_branch_only", mcp.Description("Input parameter: When forking from an existing repository, fork with only the default branch.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_in_org.go b/MCP/go/tools/repos/repos_create_in_org.go index d4d25ea..ff3269a 100644 --- a/MCP/go/tools/repos/repos_create_in_org.go +++ b/MCP/go/tools/repos/repos_create_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Repos_create_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Repos_create_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/repos%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/repos", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Repos_create_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Full_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,31 +99,31 @@ func CreateRepos_create_in_orgTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_orgs_org_repos", mcp.WithDescription("Create an organization repository"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("visibility", mcp.Description("Input parameter: The visibility of the repository.")), - mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the repository.")), - mcp.WithBoolean("allow_rebase_merge", mcp.Description("Input parameter: Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.")), + mcp.WithBoolean("has_issues", mcp.Description("Input parameter: Either `true` to enable issues for this repository or `false` to disable them.")), + mcp.WithBoolean("has_wiki", mcp.Description("Input parameter: Either `true` to enable the wiki for this repository or `false` to disable it.")), mcp.WithString("merge_commit_message", mcp.Description("Input parameter: The default value for a merge commit message.\n\n- `PR_TITLE` - default to the pull request's title.\n- `PR_BODY` - default to the pull request's body.\n- `BLANK` - default to a blank commit message.")), - mcp.WithBoolean("allow_auto_merge", mcp.Description("Input parameter: Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.")), - mcp.WithBoolean("private", mcp.Description("Input parameter: Whether the repository is private.")), - mcp.WithBoolean("allow_merge_commit", mcp.Description("Input parameter: Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.")), - mcp.WithBoolean("has_projects", mcp.Description("Input parameter: Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.")), + mcp.WithString("merge_commit_title", mcp.Description("Input parameter: Required when using `merge_commit_message`.\n\nThe default value for a merge commit title.\n\n- `PR_TITLE` - default to the pull request's title.\n- `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).")), mcp.WithBoolean("use_squash_pr_title_as_default", mcp.Description("Input parameter: Either `true` to allow squash-merge commits to use pull request title, or `false` to use commit message. **This property is closing down. Please use `squash_merge_commit_title` instead.")), - mcp.WithBoolean("auto_init", mcp.Description("Input parameter: Pass `true` to create an initial commit with empty README.")), + mcp.WithBoolean("allow_auto_merge", mcp.Description("Input parameter: Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.")), + mcp.WithBoolean("has_downloads", mcp.Description("Input parameter: Whether downloads are enabled.")), + mcp.WithString("description", mcp.Description("Input parameter: A short description of the repository.")), mcp.WithString("squash_merge_commit_title", mcp.Description("Input parameter: Required when using `squash_merge_commit_message`.\n\nThe default value for a squash merge commit title:\n\n- `PR_TITLE` - default to the pull request's title.\n- `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).")), - mcp.WithString("merge_commit_title", mcp.Description("Input parameter: Required when using `merge_commit_message`.\n\nThe default value for a merge commit title.\n\n- `PR_TITLE` - default to the pull request's title.\n- `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).")), - mcp.WithBoolean("has_wiki", mcp.Description("Input parameter: Either `true` to enable the wiki for this repository or `false` to disable it.")), + mcp.WithString("gitignore_template", mcp.Description("Input parameter: Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, \"Haskell\".")), + mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the repository.")), + mcp.WithBoolean("private", mcp.Description("Input parameter: Whether the repository is private.")), + mcp.WithString("visibility", mcp.Description("Input parameter: The visibility of the repository.")), mcp.WithString("homepage", mcp.Description("Input parameter: A URL with more information about the repository.")), - mcp.WithBoolean("has_downloads", mcp.Description("Input parameter: Whether downloads are enabled.")), + mcp.WithString("license_template", mcp.Description("Input parameter: Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://docs.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the `license_template` string. For example, \"mit\" or \"mpl-2.0\".")), + mcp.WithBoolean("delete_branch_on_merge", mcp.Description("Input parameter: Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion. **The authenticated user must be an organization owner to set this property to `true`.**")), + mcp.WithBoolean("allow_merge_commit", mcp.Description("Input parameter: Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.")), + mcp.WithBoolean("is_template", mcp.Description("Input parameter: Either `true` to make this repo available as a template repository or `false` to prevent it.")), mcp.WithString("squash_merge_commit_message", mcp.Description("Input parameter: The default value for a squash merge commit message:\n\n- `PR_BODY` - default to the pull request's body.\n- `COMMIT_MESSAGES` - default to the branch's commit messages.\n- `BLANK` - default to a blank commit message.")), + mcp.WithNumber("team_id", mcp.Description("Input parameter: The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.")), + mcp.WithBoolean("auto_init", mcp.Description("Input parameter: Pass `true` to create an initial commit with empty README.")), + mcp.WithBoolean("has_projects", mcp.Description("Input parameter: Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.")), + mcp.WithBoolean("allow_rebase_merge", mcp.Description("Input parameter: Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.")), mcp.WithBoolean("allow_squash_merge", mcp.Description("Input parameter: Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.")), mcp.WithObject("custom_properties", mcp.Description("Input parameter: The custom properties for the new repository. The keys are the custom property names, and the values are the corresponding custom property values.")), - mcp.WithBoolean("delete_branch_on_merge", mcp.Description("Input parameter: Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion. **The authenticated user must be an organization owner to set this property to `true`.**")), - mcp.WithNumber("team_id", mcp.Description("Input parameter: The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.")), - mcp.WithString("gitignore_template", mcp.Description("Input parameter: Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, \"Haskell\".")), - mcp.WithBoolean("is_template", mcp.Description("Input parameter: Either `true` to make this repo available as a template repository or `false` to prevent it.")), - mcp.WithString("license_template", mcp.Description("Input parameter: Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://docs.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the `license_template` string. For example, \"mit\" or \"mpl-2.0\".")), - mcp.WithBoolean("has_issues", mcp.Description("Input parameter: Either `true` to enable issues for this repository or `false` to disable them.")), - mcp.WithString("description", mcp.Description("Input parameter: A short description of the repository.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_or_update_custom_properties_values.go b/MCP/go/tools/repos/repos_create_or_update_custom_properties_values.go index 631a3f7..f0ce084 100644 --- a/MCP/go/tools/repos/repos_create_or_update_custom_properties_values.go +++ b/MCP/go/tools/repos/repos_create_or_update_custom_properties_values.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_or_update_custom_properties_valuesHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_or_update_custom_properties_valuesHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/properties/values%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/properties/values", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_create_or_update_environment.go b/MCP/go/tools/repos/repos_create_or_update_environment.go index 1ba51ee..45c8992 100644 --- a/MCP/go/tools/repos/repos_create_or_update_environment.go +++ b/MCP/go/tools/repos/repos_create_or_update_environment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_create_or_update_environmentHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_create_or_update_environmentHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s%s", cfg.BaseURL, owner, repo, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s", cfg.BaseURL, owner, repo, environment_name) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,15 +112,15 @@ func Repos_create_or_update_environmentHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_create_or_update_environmentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_environments_environment_name", + tool := mcp.NewTool("put_repos_owner_repo_environments_environment_name_2", mcp.WithDescription("Create or update an environment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), + mcp.WithArray("reviewers", mcp.Description("Input parameter: The people or teams that may review jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed.")), mcp.WithNumber("wait_timer", mcp.Description("Input parameter: The amount of time to delay a job after the job is initially triggered. The time (in minutes) must be an integer between 0 and 43,200 (30 days).")), mcp.WithObject("deployment_branch_policy", mcp.Description("Input parameter: The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.")), mcp.WithBoolean("prevent_self_review", mcp.Description("Input parameter: Whether or not a user who created the job is prevented from approving their own job.")), - mcp.WithArray("reviewers", mcp.Description("Input parameter: The people or teams that may review jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_or_update_file_contents.go b/MCP/go/tools/repos/repos_create_or_update_file_contents.go index 1f0c50d..47091e4 100644 --- a/MCP/go/tools/repos/repos_create_or_update_file_contents.go +++ b/MCP/go/tools/repos/repos_create_or_update_file_contents.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_create_or_update_file_contentsHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: path"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_create_or_update_file_contentsHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/contents/%s%s", cfg.BaseURL, owner, repo, path, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/contents/%s", cfg.BaseURL, owner, repo, path) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_create_or_update_file_contentsHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_File_commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,12 +117,12 @@ func CreateRepos_create_or_update_file_contentsTool(cfg *config.APIConfig) model mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("path", mcp.Required(), mcp.Description("path parameter")), - mcp.WithString("content", mcp.Required(), mcp.Description("Input parameter: The new file content, using Base64 encoding.")), - mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The commit message.")), - mcp.WithString("sha", mcp.Description("Input parameter: **Required if you are updating a file**. The blob SHA of the file being replaced.")), mcp.WithObject("author", mcp.Description("Input parameter: The author of the file. Default: The `committer` or the authenticated user if you omit `committer`.")), mcp.WithString("branch", mcp.Description("Input parameter: The branch name. Default: the repository’s default branch.")), mcp.WithObject("committer", mcp.Description("Input parameter: The person that committed the file. Default: the authenticated user.")), + mcp.WithString("content", mcp.Required(), mcp.Description("Input parameter: The new file content, using Base64 encoding.")), + mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The commit message.")), + mcp.WithString("sha", mcp.Description("Input parameter: **Required if you are updating a file**. The blob SHA of the file being replaced.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_org_ruleset.go b/MCP/go/tools/repos/repos_create_org_ruleset.go index bdef75a..1d344e9 100644 --- a/MCP/go/tools/repos/repos_create_org_ruleset.go +++ b/MCP/go/tools/repos/repos_create_org_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Repos_create_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Repos_create_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/rulesets%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/rulesets", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Repos_create_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,12 +99,12 @@ func CreateRepos_create_org_rulesetTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_orgs_org_rulesets", mcp.WithDescription("Create an organization repository ruleset"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("target", mcp.Description("Input parameter: The target of the ruleset")), - mcp.WithArray("bypass_actors", mcp.Description("Input parameter: The actors that can bypass the rules in this ruleset")), - mcp.WithObject("conditions", mcp.Description("Input parameter: Conditions for an organization ruleset.\nThe branch and tag rulesets conditions object should contain both `repository_name` and `ref_name` properties, or both `repository_id` and `ref_name` properties, or both `repository_property` and `ref_name` properties.\nThe push rulesets conditions object does not require the `ref_name` property.\nFor repository policy rulesets, the conditions object should only contain the `repository_name`, the `repository_id`, or the `repository_property`.")), mcp.WithString("enforcement", mcp.Required(), mcp.Description("Input parameter: The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the ruleset.")), mcp.WithArray("rules", mcp.Description("Input parameter: An array of rules within the ruleset.")), + mcp.WithString("target", mcp.Description("Input parameter: The target of the ruleset")), + mcp.WithArray("bypass_actors", mcp.Description("Input parameter: The actors that can bypass the rules in this ruleset")), + mcp.WithObject("conditions", mcp.Description("Input parameter: Conditions for an organization ruleset.\nThe branch and tag rulesets conditions object should contain both `repository_name` and `ref_name` properties, or both `repository_id` and `ref_name` properties, or both `repository_property` and `ref_name` properties.\nThe push rulesets conditions object does not require the `ref_name` property.\nFor repository policy rulesets, the conditions object should only contain the `repository_name`, the `repository_id`, or the `repository_property`.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_pages_deployment.go b/MCP/go/tools/repos/repos_create_pages_deployment.go index d73640b..3a3d990 100644 --- a/MCP/go/tools/repos/repos_create_pages_deployment.go +++ b/MCP/go/tools/repos/repos_create_pages_deployment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_pages_deploymentHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_pages_deploymentHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pages/deployments%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/deployments", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_create_pages_deploymentHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Page_deployment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_create_pages_site.go b/MCP/go/tools/repos/repos_create_pages_site.go index a03da64..28481a6 100644 --- a/MCP/go/tools/repos/repos_create_pages_site.go +++ b/MCP/go/tools/repos/repos_create_pages_site.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_pages_siteHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -85,23 +51,26 @@ func Repos_create_pages_siteHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pages%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,8 +108,8 @@ func CreateRepos_create_pages_siteTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a GitHub Pages site"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithObject("source", mcp.Description("Input parameter: The source branch and directory used to publish your Pages site.")), mcp.WithString("build_type", mcp.Description("Input parameter: The process in which the Page will be built. Possible values are `\"legacy\"` and `\"workflow\"`.")), + mcp.WithObject("source", mcp.Description("Input parameter: The source branch and directory used to publish your Pages site.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_release.go b/MCP/go/tools/repos/repos_create_release.go index 6053757..2a8eb34 100644 --- a/MCP/go/tools/repos/repos_create_release.go +++ b/MCP/go/tools/repos/repos_create_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_releaseHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_releaseHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/releases%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,15 +108,15 @@ func CreateRepos_create_releaseTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a release"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("discussion_category_name", mcp.Description("Input parameter: If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see \"[Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository).\"")), + mcp.WithBoolean("draft", mcp.Description("Input parameter: `true` to create a draft (unpublished) release, `false` to create a published one.")), + mcp.WithString("make_latest", mcp.Description("Input parameter: Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to `true` for newly published releases. `legacy` specifies that the latest release should be determined based on the release creation date and higher semantic version.")), mcp.WithString("tag_name", mcp.Required(), mcp.Description("Input parameter: The name of the tag.")), + mcp.WithBoolean("prerelease", mcp.Description("Input parameter: `true` to identify the release as a prerelease. `false` to identify the release as a full release.")), + mcp.WithString("target_commitish", mcp.Description("Input parameter: Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch.")), mcp.WithString("body", mcp.Description("Input parameter: Text describing the contents of the tag.")), - mcp.WithString("discussion_category_name", mcp.Description("Input parameter: If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see \"[Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository).\"")), mcp.WithBoolean("generate_release_notes", mcp.Description("Input parameter: Whether to automatically generate the name and body for this release. If `name` is specified, the specified name will be used; otherwise, a name will be automatically generated. If `body` is specified, the body will be pre-pended to the automatically generated notes.")), mcp.WithString("name", mcp.Description("Input parameter: The name of the release.")), - mcp.WithBoolean("prerelease", mcp.Description("Input parameter: `true` to identify the release as a prerelease. `false` to identify the release as a full release.")), - mcp.WithString("target_commitish", mcp.Description("Input parameter: Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch.")), - mcp.WithBoolean("draft", mcp.Description("Input parameter: `true` to create a draft (unpublished) release, `false` to create a published one.")), - mcp.WithString("make_latest", mcp.Description("Input parameter: Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to `true` for newly published releases. `legacy` specifies that the latest release should be determined based on the release creation date and higher semantic version.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_repo_ruleset.go b/MCP/go/tools/repos/repos_create_repo_ruleset.go index 02465de..161de8a 100644 --- a/MCP/go/tools/repos/repos_create_repo_ruleset.go +++ b/MCP/go/tools/repos/repos_create_repo_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/rulesets%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/rulesets", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_create_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,12 +108,12 @@ func CreateRepos_create_repo_rulesetTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Create a repository ruleset"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithArray("rules", mcp.Description("Input parameter: An array of rules within the ruleset.")), mcp.WithString("target", mcp.Description("Input parameter: The target of the ruleset")), mcp.WithArray("bypass_actors", mcp.Description("Input parameter: The actors that can bypass the rules in this ruleset")), mcp.WithObject("conditions", mcp.Description("Input parameter: Parameters for a repository ruleset ref name condition")), mcp.WithString("enforcement", mcp.Required(), mcp.Description("Input parameter: The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the ruleset.")), + mcp.WithArray("rules", mcp.Description("Input parameter: An array of rules within the ruleset.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_create_tag_protection.go b/MCP/go/tools/repos/repos_create_tag_protection.go index 6e1f39c..cb16818 100644 --- a/MCP/go/tools/repos/repos_create_tag_protection.go +++ b/MCP/go/tools/repos/repos_create_tag_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_tag_protectionHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_tag_protectionHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/tags/protection%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/tags/protection", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_create_tag_protectionHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Tag_protection if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_create_using_template.go b/MCP/go/tools/repos/repos_create_using_template.go index b0bc532..17e89f0 100644 --- a/MCP/go/tools/repos/repos_create_using_template.go +++ b/MCP/go/tools/repos/repos_create_using_template.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_using_templateHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: template_repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_using_templateHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/generate%s", cfg.BaseURL, template_owner, template_repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/generate", cfg.BaseURL, template_owner, template_repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_create_using_templateHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Full_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -135,7 +104,7 @@ func Repos_create_using_templateHandler(cfg *config.APIConfig) func(ctx context. } func CreateRepos_create_using_templateTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_template_owner_template_repo_generate", + tool := mcp.NewTool("post_repos_template_owner_repo_generate", mcp.WithDescription("Create a repository using a template"), mcp.WithString("template_owner", mcp.Required(), mcp.Description("The account owner of the template repository. The name is not case sensitive.")), mcp.WithString("template_repo", mcp.Required(), mcp.Description("The name of the template repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_create_webhook.go b/MCP/go/tools/repos/repos_create_webhook.go index 822307a..8b8280a 100644 --- a/MCP/go/tools/repos/repos_create_webhook.go +++ b/MCP/go/tools/repos/repos_create_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_create_webhookHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_create_webhookHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/hooks%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_decline_invitation_for_authenticated_user.go b/MCP/go/tools/repos/repos_decline_invitation_for_authenticated_user.go index 37de49d..085183d 100644 --- a/MCP/go/tools/repos/repos_decline_invitation_for_authenticated_user.go +++ b/MCP/go/tools/repos/repos_decline_invitation_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Repos_decline_invitation_for_authenticated_userHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: invitation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/repository_invitations/%s%s", cfg.BaseURL, invitation_id, queryString) + url := fmt.Sprintf("%s/user/repository_invitations/%s", cfg.BaseURL, invitation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete.go b/MCP/go/tools/repos/repos_delete.go index e3dbf23..c487ea7 100644 --- a/MCP/go/tools/repos/repos_delete.go +++ b/MCP/go/tools/repos/repos_delete.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_deleteHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_access_restrictions.go b/MCP/go/tools/repos/repos_delete_access_restrictions.go index 5ac96bb..a6e58ea 100644 --- a/MCP/go/tools/repos/repos_delete_access_restrictions.go +++ b/MCP/go/tools/repos/repos_delete_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_access_restrictionsHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_access_restrictionsHandler(cfg *config.APIConfig) func(ctx con } func CreateRepos_delete_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_restrictions", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Delete access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_admin_branch_protection.go b/MCP/go/tools/repos/repos_delete_admin_branch_protection.go index 200d6e9..e082401 100644 --- a/MCP/go/tools/repos/repos_delete_admin_branch_protection.go +++ b/MCP/go/tools/repos/repos_delete_admin_branch_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/enforce_admins%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/enforce_admins", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx } func CreateRepos_delete_admin_branch_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_enforce_admins", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_enforce", mcp.WithDescription("Delete admin branch protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_an_environment.go b/MCP/go/tools/repos/repos_delete_an_environment.go index c313bf9..57a9f33 100644 --- a/MCP/go/tools/repos/repos_delete_an_environment.go +++ b/MCP/go/tools/repos/repos_delete_an_environment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_an_environmentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s%s", cfg.BaseURL, owner, repo, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s", cfg.BaseURL, owner, repo, environment_name) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_an_environmentHandler(cfg *config.APIConfig) func(ctx context. } func CreateRepos_delete_an_environmentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name", + tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name_2", mcp.WithDescription("Delete an environment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_autolink.go b/MCP/go/tools/repos/repos_delete_autolink.go index b599d0e..2addc6f 100644 --- a/MCP/go/tools/repos/repos_delete_autolink.go +++ b/MCP/go/tools/repos/repos_delete_autolink.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_autolinkHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: autolink_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/autolinks/%s%s", cfg.BaseURL, owner, repo, autolink_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/autolinks/%s", cfg.BaseURL, owner, repo, autolink_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_branch_protection.go b/MCP/go/tools/repos/repos_delete_branch_protection.go index 71cfded..226962a 100644 --- a/MCP/go/tools/repos/repos_delete_branch_protection.go +++ b/MCP/go/tools/repos/repos_delete_branch_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_branch_protectionHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_branch_protectionHandler(cfg *config.APIConfig) func(ctx conte } func CreateRepos_delete_branch_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_2", mcp.WithDescription("Delete branch protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_commit_comment.go b/MCP/go/tools/repos/repos_delete_commit_comment.go index 068faea..9932302 100644 --- a/MCP/go/tools/repos/repos_delete_commit_comment.go +++ b/MCP/go/tools/repos/repos_delete_commit_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_commit_commentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_commit_signature_protection.go b/MCP/go/tools/repos/repos_delete_commit_signature_protection.go index 06f6d88..61903ac 100644 --- a/MCP/go/tools/repos/repos_delete_commit_signature_protection.go +++ b/MCP/go/tools/repos/repos_delete_commit_signature_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_commit_signature_protectionHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_signatures%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_signatures", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_commit_signature_protectionHandler(cfg *config.APIConfig) func } func CreateRepos_delete_commit_signature_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required_signatures", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Delete commit signature protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_deploy_key.go b/MCP/go/tools/repos/repos_delete_deploy_key.go index 96f6bf0..b1d2d73 100644 --- a/MCP/go/tools/repos/repos_delete_deploy_key.go +++ b/MCP/go/tools/repos/repos_delete_deploy_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_deploy_keyHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/keys/%s%s", cfg.BaseURL, owner, repo, key_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/keys/%s", cfg.BaseURL, owner, repo, key_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_deployment.go b/MCP/go/tools/repos/repos_delete_deployment.go index ae69a6b..8449df5 100644 --- a/MCP/go/tools/repos/repos_delete_deployment.go +++ b/MCP/go/tools/repos/repos_delete_deployment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_deploymentHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: deployment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s%s", cfg.BaseURL, owner, repo, deployment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s", cfg.BaseURL, owner, repo, deployment_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_deployment_branch_policy.go b/MCP/go/tools/repos/repos_delete_deployment_branch_policy.go index 5086089..004a187 100644 --- a/MCP/go/tools/repos/repos_delete_deployment_branch_policy.go +++ b/MCP/go/tools/repos/repos_delete_deployment_branch_policy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_delete_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: branch_policy_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies/%s%s", cfg.BaseURL, owner, repo, environment_name, branch_policy_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies/%s", cfg.BaseURL, owner, repo, environment_name, branch_policy_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Repos_delete_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct } func CreateRepos_delete_deployment_branch_policyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name_deployment-branch-policies_branch_policy_id", + tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name", mcp.WithDescription("Delete a deployment branch policy"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_file.go b/MCP/go/tools/repos/repos_delete_file.go index efe3363..9a43968 100644 --- a/MCP/go/tools/repos/repos_delete_file.go +++ b/MCP/go/tools/repos/repos_delete_file.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_delete_fileHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: path"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_delete_fileHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/contents/%s%s", cfg.BaseURL, owner, repo, path, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/contents/%s", cfg.BaseURL, owner, repo, path) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_delete_fileHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_File_commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,11 +117,11 @@ func CreateRepos_delete_fileTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("path", mcp.Required(), mcp.Description("path parameter")), - mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The commit message.")), mcp.WithString("sha", mcp.Required(), mcp.Description("Input parameter: The blob SHA of the file being deleted.")), mcp.WithObject("author", mcp.Description("Input parameter: object containing information about the author.")), mcp.WithString("branch", mcp.Description("Input parameter: The branch name. Default: the repository’s default branch")), mcp.WithObject("committer", mcp.Description("Input parameter: object containing information about the committer.")), + mcp.WithString("message", mcp.Required(), mcp.Description("Input parameter: The commit message.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_delete_invitation.go b/MCP/go/tools/repos/repos_delete_invitation.go index 5984c8a..e790fd9 100644 --- a/MCP/go/tools/repos/repos_delete_invitation.go +++ b/MCP/go/tools/repos/repos_delete_invitation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_invitationHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: invitation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/invitations/%s%s", cfg.BaseURL, owner, repo, invitation_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/invitations/%s", cfg.BaseURL, owner, repo, invitation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_org_ruleset.go b/MCP/go/tools/repos/repos_delete_org_ruleset.go index f081d3e..a7da77f 100644 --- a/MCP/go/tools/repos/repos_delete_org_ruleset.go +++ b/MCP/go/tools/repos/repos_delete_org_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_delete_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: ruleset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/rulesets/%s%s", cfg.BaseURL, org, ruleset_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/rulesets/%s", cfg.BaseURL, org, ruleset_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_pages_site.go b/MCP/go/tools/repos/repos_delete_pages_site.go index c507319..1aaccec 100644 --- a/MCP/go/tools/repos/repos_delete_pages_site.go +++ b/MCP/go/tools/repos/repos_delete_pages_site.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_delete_pages_siteHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_pull_request_review_protection.go b/MCP/go/tools/repos/repos_delete_pull_request_review_protection.go index 9a0f4fa..1a43be7 100644 --- a/MCP/go/tools/repos/repos_delete_pull_request_review_protection.go +++ b/MCP/go/tools/repos/repos_delete_pull_request_review_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_pull_request_review_protectionHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_pull_request_reviews%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_pull_request_reviews", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_pull_request_review_protectionHandler(cfg *config.APIConfig) f } func CreateRepos_delete_pull_request_review_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required_pull_request_reviews", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Delete pull request review protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_release.go b/MCP/go/tools/repos/repos_delete_release.go index 91b8712..852eef5 100644 --- a/MCP/go/tools/repos/repos_delete_release.go +++ b/MCP/go/tools/repos/repos_delete_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_releaseHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: release_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/%s%s", cfg.BaseURL, owner, repo, release_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/%s", cfg.BaseURL, owner, repo, release_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_release_asset.go b/MCP/go/tools/repos/repos_delete_release_asset.go index 7cb99fe..ab2eb13 100644 --- a/MCP/go/tools/repos/repos_delete_release_asset.go +++ b/MCP/go/tools/repos/repos_delete_release_asset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_release_assetHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: asset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/assets/%s%s", cfg.BaseURL, owner, repo, asset_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/assets/%s", cfg.BaseURL, owner, repo, asset_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_repo_ruleset.go b/MCP/go/tools/repos/repos_delete_repo_ruleset.go index 12ed871..e0a51ac 100644 --- a/MCP/go/tools/repos/repos_delete_repo_ruleset.go +++ b/MCP/go/tools/repos/repos_delete_repo_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: ruleset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/rulesets/%s%s", cfg.BaseURL, owner, repo, ruleset_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/rulesets/%s", cfg.BaseURL, owner, repo, ruleset_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_delete_tag_protection.go b/MCP/go/tools/repos/repos_delete_tag_protection.go index e1fcb68..b73cd2f 100644 --- a/MCP/go/tools/repos/repos_delete_tag_protection.go +++ b/MCP/go/tools/repos/repos_delete_tag_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_tag_protectionHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: tag_protection_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/tags/protection/%s%s", cfg.BaseURL, owner, repo, tag_protection_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/tags/protection/%s", cfg.BaseURL, owner, repo, tag_protection_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_delete_tag_protectionHandler(cfg *config.APIConfig) func(ctx context. } func CreateRepos_delete_tag_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_tags_protection_tag_protection_id", + tool := mcp.NewTool("delete_repos_owner_repo_tags_protection_tag_id", mcp.WithDescription("Closing down - Delete a tag protection state for a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_delete_webhook.go b/MCP/go/tools/repos/repos_delete_webhook.go index b9e940c..8e9011b 100644 --- a/MCP/go/tools/repos/repos_delete_webhook.go +++ b/MCP/go/tools/repos/repos_delete_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_delete_webhookHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_disable_automated_security_fixes.go b/MCP/go/tools/repos/repos_disable_automated_security_fixes.go index bed8c5c..14a04ff 100644 --- a/MCP/go/tools/repos/repos_disable_automated_security_fixes.go +++ b/MCP/go/tools/repos/repos_disable_automated_security_fixes.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_disable_automated_security_fixesHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/automated-security-fixes%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/automated-security-fixes", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_disable_deployment_protection_rule.go b/MCP/go/tools/repos/repos_disable_deployment_protection_rule.go index e6a455d..a7eab32 100644 --- a/MCP/go/tools/repos/repos_disable_deployment_protection_rule.go +++ b/MCP/go/tools/repos/repos_disable_deployment_protection_rule.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_disable_deployment_protection_ruleHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: protection_rule_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules/%s%s", cfg.BaseURL, environment_name, repo, owner, protection_rule_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules/%s", cfg.BaseURL, environment_name, repo, owner, protection_rule_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Repos_disable_deployment_protection_ruleHandler(cfg *config.APIConfig) func } func CreateRepos_disable_deployment_protection_ruleTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name_deployment_protection_rules_protection_rule_id", + tool := mcp.NewTool("delete_repos_owner_repo_environments_environment_name", mcp.WithDescription("Disable a custom protection rule for an environment"), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_disable_private_vulnerability_reporting.go b/MCP/go/tools/repos/repos_disable_private_vulnerability_reporting.go index 965e50c..eb4cc6f 100644 --- a/MCP/go/tools/repos/repos_disable_private_vulnerability_reporting.go +++ b/MCP/go/tools/repos/repos_disable_private_vulnerability_reporting.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_disable_private_vulnerability_reportingHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/private-vulnerability-reporting%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/private-vulnerability-reporting", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_disable_vulnerability_alerts.go b/MCP/go/tools/repos/repos_disable_vulnerability_alerts.go index e99ba98..45ed54b 100644 --- a/MCP/go/tools/repos/repos_disable_vulnerability_alerts.go +++ b/MCP/go/tools/repos/repos_disable_vulnerability_alerts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_disable_vulnerability_alertsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/vulnerability-alerts%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/vulnerability-alerts", cfg.BaseURL, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_download_tarball_archive.go b/MCP/go/tools/repos/repos_download_tarball_archive.go index 5f65f09..0a6a555 100644 --- a/MCP/go/tools/repos/repos_download_tarball_archive.go +++ b/MCP/go/tools/repos/repos_download_tarball_archive.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_download_tarball_archiveHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: ref"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/tarball/%s%s", cfg.BaseURL, owner, repo, ref, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/tarball/%s", cfg.BaseURL, owner, repo, ref) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_download_zipball_archive.go b/MCP/go/tools/repos/repos_download_zipball_archive.go index 0376dd1..88d7916 100644 --- a/MCP/go/tools/repos/repos_download_zipball_archive.go +++ b/MCP/go/tools/repos/repos_download_zipball_archive.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_download_zipball_archiveHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: ref"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/zipball/%s%s", cfg.BaseURL, owner, repo, ref, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/zipball/%s", cfg.BaseURL, owner, repo, ref) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_enable_automated_security_fixes.go b/MCP/go/tools/repos/repos_enable_automated_security_fixes.go index 2b062ac..d67ab77 100644 --- a/MCP/go/tools/repos/repos_enable_automated_security_fixes.go +++ b/MCP/go/tools/repos/repos_enable_automated_security_fixes.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_enable_automated_security_fixesHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/automated-security-fixes%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/automated-security-fixes", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_enable_private_vulnerability_reporting.go b/MCP/go/tools/repos/repos_enable_private_vulnerability_reporting.go index 09f0fc6..fa981b2 100644 --- a/MCP/go/tools/repos/repos_enable_private_vulnerability_reporting.go +++ b/MCP/go/tools/repos/repos_enable_private_vulnerability_reporting.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_enable_private_vulnerability_reportingHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/private-vulnerability-reporting%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/private-vulnerability-reporting", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_enable_vulnerability_alerts.go b/MCP/go/tools/repos/repos_enable_vulnerability_alerts.go index b27c582..74cf101 100644 --- a/MCP/go/tools/repos/repos_enable_vulnerability_alerts.go +++ b/MCP/go/tools/repos/repos_enable_vulnerability_alerts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_enable_vulnerability_alertsHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/vulnerability-alerts%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/vulnerability-alerts", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_generate_release_notes.go b/MCP/go/tools/repos/repos_generate_release_notes.go index 6c11f5f..29662eb 100644 --- a/MCP/go/tools/repos/repos_generate_release_notes.go +++ b/MCP/go/tools/repos/repos_generate_release_notes.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_generate_release_notesHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_generate_release_notesHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/releases/generate-notes%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/generate-notes", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_generate_release_notesHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Release_notes_content if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,10 +108,10 @@ func CreateRepos_generate_release_notesTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Generate release notes content for a release"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithString("target_commitish", mcp.Description("Input parameter: Specifies the commitish value that will be the target for the release's tag. Required if the supplied tag_name does not reference an existing tag. Ignored if the tag_name already exists.")), mcp.WithString("configuration_file_path", mcp.Description("Input parameter: Specifies a path to a file in the repository containing configuration settings used for generating the release notes. If unspecified, the configuration file located in the repository at '.github/release.yml' or '.github/release.yaml' will be used. If that is not present, the default configuration will be used.")), mcp.WithString("previous_tag_name", mcp.Description("Input parameter: The name of the previous tag to use as the starting point for the release notes. Use to manually specify the range for the set of changes considered as part this release.")), mcp.WithString("tag_name", mcp.Required(), mcp.Description("Input parameter: The tag name for the release. This can be an existing tag or a new one.")), + mcp.WithString("target_commitish", mcp.Description("Input parameter: Specifies the commitish value that will be the target for the release's tag. Required if the supplied tag_name does not reference an existing tag. Ignored if the tag_name already exists.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_get.go b/MCP/go/tools/repos/repos_get.go index 3a3e70f..870d7c4 100644 --- a/MCP/go/tools/repos/repos_get.go +++ b/MCP/go/tools/repos/repos_get.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_getHandler(cfg *config.APIConfig) func(ctx context.Context, request m if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_getHandler(cfg *config.APIConfig) func(ctx context.Context, request m return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Full_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_access_restrictions.go b/MCP/go/tools/repos/repos_get_access_restrictions.go index c037e87..f984b88 100644 --- a/MCP/go/tools/repos/repos_get_access_restrictions.go +++ b/MCP/go/tools/repos/repos_get_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_access_restrictionsHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_access_restrictionsHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Branch_restriction_policy if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_admin_branch_protection.go b/MCP/go/tools/repos/repos_get_admin_branch_protection.go index 1fa914d..01c2eb5 100644 --- a/MCP/go/tools/repos/repos_get_admin_branch_protection.go +++ b/MCP/go/tools/repos/repos_get_admin_branch_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/enforce_admins%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/enforce_admins", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch_admin_enforced if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx co } func CreateRepos_get_admin_branch_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_enforce_admins", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_enforce", mcp.WithDescription("Get admin branch protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_all_deployment_protection_rules.go b/MCP/go/tools/repos/repos_get_all_deployment_protection_rules.go index eef4169..422e67f 100644 --- a/MCP/go/tools/repos/repos_get_all_deployment_protection_rules.go +++ b/MCP/go/tools/repos/repos_get_all_deployment_protection_rules.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_all_deployment_protection_rulesHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: owner"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules%s", cfg.BaseURL, environment_name, repo, owner, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules", cfg.BaseURL, environment_name, repo, owner) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_get_all_deployment_protection_rulesHandler(cfg *config.APIConfig) fun } func CreateRepos_get_all_deployment_protection_rulesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_deployment_protection_rules", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name", mcp.WithDescription("Get all deployment protection rules for an environment"), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_all_environments.go b/MCP/go/tools/repos/repos_get_all_environments.go index d775d0b..9a080c3 100644 --- a/MCP/go/tools/repos/repos_get_all_environments.go +++ b/MCP/go/tools/repos/repos_get_all_environments.go @@ -42,34 +42,6 @@ func Repos_get_all_environmentsHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_get_all_environmentsHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_all_status_check_contexts.go b/MCP/go/tools/repos/repos_get_all_status_check_contexts.go index a4e86a0..13feded 100644 --- a/MCP/go/tools/repos/repos_get_all_status_check_contexts.go +++ b/MCP/go/tools/repos/repos_get_all_status_check_contexts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_all_status_check_contextsHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_get_all_status_check_contextsHandler(cfg *config.APIConfig) func(ctx } func CreateRepos_get_all_status_check_contextsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required_status_checks_contexts", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Get all status check contexts"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_all_topics.go b/MCP/go/tools/repos/repos_get_all_topics.go index cb2e013..37394a2 100644 --- a/MCP/go/tools/repos/repos_get_all_topics.go +++ b/MCP/go/tools/repos/repos_get_all_topics.go @@ -42,34 +42,6 @@ func Repos_get_all_topicsHandler(cfg *config.APIConfig) func(ctx context.Context if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_get_all_topicsHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_apps_with_access_to_protected_branch.go b/MCP/go/tools/repos/repos_get_apps_with_access_to_protected_branch.go index 2d7bc5f..1b805fb 100644 --- a/MCP/go/tools/repos/repos_get_apps_with_access_to_protected_branch.go +++ b/MCP/go/tools/repos/repos_get_apps_with_access_to_protected_branch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_apps_with_access_to_protected_branchHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_apps_with_access_to_protected_branchHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Integration + var result []models.Integration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_apps_with_access_to_protected_branchHandler(cfg *config.APIConfig } func CreateRepos_get_apps_with_access_to_protected_branchTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_restrictions_apps", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_restrictions", mcp.WithDescription("Get apps with access to the protected branch"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_autolink.go b/MCP/go/tools/repos/repos_get_autolink.go index 862f4d7..b084b52 100644 --- a/MCP/go/tools/repos/repos_get_autolink.go +++ b/MCP/go/tools/repos/repos_get_autolink.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_autolinkHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: autolink_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/autolinks/%s%s", cfg.BaseURL, owner, repo, autolink_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/autolinks/%s", cfg.BaseURL, owner, repo, autolink_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_branch.go b/MCP/go/tools/repos/repos_get_branch.go index 3f0866b..0ed7f81 100644 --- a/MCP/go/tools/repos/repos_get_branch.go +++ b/MCP/go/tools/repos/repos_get_branch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_branchHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_branchHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Branch_with_protection if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_branch_protection.go b/MCP/go/tools/repos/repos_get_branch_protection.go index ab01fcd..271030a 100644 --- a/MCP/go/tools/repos/repos_get_branch_protection.go +++ b/MCP/go/tools/repos/repos_get_branch_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_branch_protectionHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_branch_protectionHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Branch_protection if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_branch_rules.go b/MCP/go/tools/repos/repos_get_branch_rules.go index 2bbb05a..36bc3e7 100644 --- a/MCP/go/tools/repos/repos_get_branch_rules.go +++ b/MCP/go/tools/repos/repos_get_branch_rules.go @@ -50,34 +50,6 @@ func Repos_get_branch_rulesHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_get_branch_rulesHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_get_branch_rulesHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_rule_detailed if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_clones.go b/MCP/go/tools/repos/repos_get_clones.go index 83a3bca..743cfa6 100644 --- a/MCP/go/tools/repos/repos_get_clones.go +++ b/MCP/go/tools/repos/repos_get_clones.go @@ -39,34 +39,6 @@ func Repos_get_clonesHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["per"]; ok { queryParams = append(queryParams, fmt.Sprintf("per=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Repos_get_clonesHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -104,7 +79,7 @@ func Repos_get_clonesHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Clone_traffic if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_code_frequency_stats.go b/MCP/go/tools/repos/repos_get_code_frequency_stats.go index 5f273b1..d63c9a2 100644 --- a/MCP/go/tools/repos/repos_get_code_frequency_stats.go +++ b/MCP/go/tools/repos/repos_get_code_frequency_stats.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_code_frequency_statsHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/stats/code_frequency%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/stats/code_frequency", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_collaborator_permission_level.go b/MCP/go/tools/repos/repos_get_collaborator_permission_level.go index 08dbe3f..ed1195d 100644 --- a/MCP/go/tools/repos/repos_get_collaborator_permission_level.go +++ b/MCP/go/tools/repos/repos_get_collaborator_permission_level.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_collaborator_permission_levelHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s/permission%s", cfg.BaseURL, owner, repo, username, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s/permission", cfg.BaseURL, owner, repo, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_collaborator_permission_levelHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_collaborator_permission if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_combined_status_for_ref.go b/MCP/go/tools/repos/repos_get_combined_status_for_ref.go index bd808a1..ea4ec2e 100644 --- a/MCP/go/tools/repos/repos_get_combined_status_for_ref.go +++ b/MCP/go/tools/repos/repos_get_combined_status_for_ref.go @@ -50,34 +50,6 @@ func Repos_get_combined_status_for_refHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_get_combined_status_for_refHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_get_combined_status_for_refHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Combined_commit_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_commit.go b/MCP/go/tools/repos/repos_get_commit.go index 055f8d7..559f3b4 100644 --- a/MCP/go/tools/repos/repos_get_commit.go +++ b/MCP/go/tools/repos/repos_get_commit.go @@ -50,34 +50,6 @@ func Repos_get_commitHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_get_commitHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_commit_activity_stats.go b/MCP/go/tools/repos/repos_get_commit_activity_stats.go index c4448e9..1d69cb4 100644 --- a/MCP/go/tools/repos/repos_get_commit_activity_stats.go +++ b/MCP/go/tools/repos/repos_get_commit_activity_stats.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_commit_activity_statsHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/stats/commit_activity%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/stats/commit_activity", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_commit_activity_statsHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Commit_activity if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_commit_comment.go b/MCP/go/tools/repos/repos_get_commit_comment.go index b31e806..b902a5f 100644 --- a/MCP/go/tools/repos/repos_get_commit_comment.go +++ b/MCP/go/tools/repos/repos_get_commit_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_commit_commentHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_commit_commentHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Commit_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_commit_signature_protection.go b/MCP/go/tools/repos/repos_get_commit_signature_protection.go index 864d5e8..f0ee692 100644 --- a/MCP/go/tools/repos/repos_get_commit_signature_protection.go +++ b/MCP/go/tools/repos/repos_get_commit_signature_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_commit_signature_protectionHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_signatures%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_signatures", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_commit_signature_protectionHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch_admin_enforced if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_commit_signature_protectionHandler(cfg *config.APIConfig) func(ct } func CreateRepos_get_commit_signature_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required_signatures", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Get commit signature protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_community_profile_metrics.go b/MCP/go/tools/repos/repos_get_community_profile_metrics.go index 5fb209f..03790ec 100644 --- a/MCP/go/tools/repos/repos_get_community_profile_metrics.go +++ b/MCP/go/tools/repos/repos_get_community_profile_metrics.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_community_profile_metricsHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/community/profile%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/community/profile", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_community_profile_metricsHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Community_profile if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_content.go b/MCP/go/tools/repos/repos_get_content.go index 39fdb1a..4f0986e 100644 --- a/MCP/go/tools/repos/repos_get_content.go +++ b/MCP/go/tools/repos/repos_get_content.go @@ -47,34 +47,6 @@ func Repos_get_contentHandler(cfg *config.APIConfig) func(ctx context.Context, r if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Repos_get_contentHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_contributors_stats.go b/MCP/go/tools/repos/repos_get_contributors_stats.go index 643a35d..81f3bf9 100644 --- a/MCP/go/tools/repos/repos_get_contributors_stats.go +++ b/MCP/go/tools/repos/repos_get_contributors_stats.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_contributors_statsHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/stats/contributors%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/stats/contributors", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_contributors_statsHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Contributor_activity if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_custom_deployment_protection_rule.go b/MCP/go/tools/repos/repos_get_custom_deployment_protection_rule.go index a06e685..22929e4 100644 --- a/MCP/go/tools/repos/repos_get_custom_deployment_protection_rule.go +++ b/MCP/go/tools/repos/repos_get_custom_deployment_protection_rule.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_get_custom_deployment_protection_ruleHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: protection_rule_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules/%s%s", cfg.BaseURL, owner, repo, environment_name, protection_rule_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment_protection_rules/%s", cfg.BaseURL, owner, repo, environment_name, protection_rule_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Repos_get_custom_deployment_protection_ruleHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_protection_rule if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Repos_get_custom_deployment_protection_ruleHandler(cfg *config.APIConfig) f } func CreateRepos_get_custom_deployment_protection_ruleTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_deployment_protection_rules_protection_rule_id", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name", mcp.WithDescription("Get a custom deployment protection rule"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_custom_properties_values.go b/MCP/go/tools/repos/repos_get_custom_properties_values.go index 30056f4..81b41f5 100644 --- a/MCP/go/tools/repos/repos_get_custom_properties_values.go +++ b/MCP/go/tools/repos/repos_get_custom_properties_values.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_custom_properties_valuesHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/properties/values%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/properties/values", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_custom_properties_valuesHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Custom_property_value if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_deploy_key.go b/MCP/go/tools/repos/repos_get_deploy_key.go index 084317f..48e84e2 100644 --- a/MCP/go/tools/repos/repos_get_deploy_key.go +++ b/MCP/go/tools/repos/repos_get_deploy_key.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_deploy_keyHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/keys/%s%s", cfg.BaseURL, owner, repo, key_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/keys/%s", cfg.BaseURL, owner, repo, key_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_deploy_keyHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deploy_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_deployment.go b/MCP/go/tools/repos/repos_get_deployment.go index 67974b4..0693931 100644 --- a/MCP/go/tools/repos/repos_get_deployment.go +++ b/MCP/go/tools/repos/repos_get_deployment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_deploymentHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: deployment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s%s", cfg.BaseURL, owner, repo, deployment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s", cfg.BaseURL, owner, repo, deployment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_deployment_branch_policy.go b/MCP/go/tools/repos/repos_get_deployment_branch_policy.go index 15c62da..43f0c46 100644 --- a/MCP/go/tools/repos/repos_get_deployment_branch_policy.go +++ b/MCP/go/tools/repos/repos_get_deployment_branch_policy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_get_deployment_branch_policyHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch_policy_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies/%s%s", cfg.BaseURL, owner, repo, environment_name, branch_policy_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies/%s", cfg.BaseURL, owner, repo, environment_name, branch_policy_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Repos_get_deployment_branch_policyHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_branch_policy if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Repos_get_deployment_branch_policyHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_get_deployment_branch_policyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_deployment-branch-policies_branch_policy_id", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name", mcp.WithDescription("Get a deployment branch policy"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_deployment_status.go b/MCP/go/tools/repos/repos_get_deployment_status.go index 894667e..2ed5364 100644 --- a/MCP/go/tools/repos/repos_get_deployment_status.go +++ b/MCP/go/tools/repos/repos_get_deployment_status.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_get_deployment_statusHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: status_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s/statuses/%s%s", cfg.BaseURL, owner, repo, deployment_id, status_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/deployments/%s/statuses/%s", cfg.BaseURL, owner, repo, deployment_id, status_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Repos_get_deployment_statusHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Repos_get_deployment_statusHandler(cfg *config.APIConfig) func(ctx context. } func CreateRepos_get_deployment_statusTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_deployments_deployment_id_statuses_status_id", + tool := mcp.NewTool("get_repos_owner_repo_deployments_deployment_id_statuses", mcp.WithDescription("Get a deployment status"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_environment.go b/MCP/go/tools/repos/repos_get_environment.go index a94d34d..7042461 100644 --- a/MCP/go/tools/repos/repos_get_environment.go +++ b/MCP/go/tools/repos/repos_get_environment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_environmentHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: environment_name"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s%s", cfg.BaseURL, owner, repo, environment_name, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s", cfg.BaseURL, owner, repo, environment_name) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_get_environmentHandler(cfg *config.APIConfig) func(ctx context.Contex } func CreateRepos_get_environmentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_2", mcp.WithDescription("Get an environment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_latest_pages_build.go b/MCP/go/tools/repos/repos_get_latest_pages_build.go index 7705217..a3f0c69 100644 --- a/MCP/go/tools/repos/repos_get_latest_pages_build.go +++ b/MCP/go/tools/repos/repos_get_latest_pages_build.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_latest_pages_buildHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages/builds/latest%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/builds/latest", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_latest_pages_buildHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Page_build if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_latest_release.go b/MCP/go/tools/repos/repos_get_latest_release.go index 446ebf7..a0097d0 100644 --- a/MCP/go/tools/repos/repos_get_latest_release.go +++ b/MCP/go/tools/repos/repos_get_latest_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_latest_releaseHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/latest%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/latest", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_org_rule_suite.go b/MCP/go/tools/repos/repos_get_org_rule_suite.go index b9302ec..7014586 100644 --- a/MCP/go/tools/repos/repos_get_org_rule_suite.go +++ b/MCP/go/tools/repos/repos_get_org_rule_suite.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_org_rule_suiteHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: rule_suite_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/rulesets/rule-suites/%s%s", cfg.BaseURL, org, rule_suite_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/rulesets/rule-suites/%s", cfg.BaseURL, org, rule_suite_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_org_rule_suiteHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Rule_suite if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_org_rule_suites.go b/MCP/go/tools/repos/repos_get_org_rule_suites.go index b196525..535feea 100644 --- a/MCP/go/tools/repos/repos_get_org_rule_suites.go +++ b/MCP/go/tools/repos/repos_get_org_rule_suites.go @@ -49,34 +49,6 @@ func Repos_get_org_rule_suitesHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -86,17 +58,20 @@ func Repos_get_org_rule_suitesHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_org_ruleset.go b/MCP/go/tools/repos/repos_get_org_ruleset.go index 303c370..171f248 100644 --- a/MCP/go/tools/repos/repos_get_org_ruleset.go +++ b/MCP/go/tools/repos/repos_get_org_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: ruleset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/rulesets/%s%s", cfg.BaseURL, org, ruleset_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/rulesets/%s", cfg.BaseURL, org, ruleset_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_org_rulesets.go b/MCP/go/tools/repos/repos_get_org_rulesets.go index e8f7e3c..8386fba 100644 --- a/MCP/go/tools/repos/repos_get_org_rulesets.go +++ b/MCP/go/tools/repos/repos_get_org_rulesets.go @@ -37,34 +37,6 @@ func Repos_get_org_rulesetsHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["targets"]; ok { queryParams = append(queryParams, fmt.Sprintf("targets=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Repos_get_org_rulesetsHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Repos_get_org_rulesetsHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_pages.go b/MCP/go/tools/repos/repos_get_pages.go index 000dfcb..9fb9740 100644 --- a/MCP/go/tools/repos/repos_get_pages.go +++ b/MCP/go/tools/repos/repos_get_pages.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_pagesHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_pages_build.go b/MCP/go/tools/repos/repos_get_pages_build.go index ef0228c..9d786d4 100644 --- a/MCP/go/tools/repos/repos_get_pages_build.go +++ b/MCP/go/tools/repos/repos_get_pages_build.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_pages_buildHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: build_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages/builds/%s%s", cfg.BaseURL, owner, repo, build_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/builds/%s", cfg.BaseURL, owner, repo, build_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_pages_buildHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Page_build if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_pages_deployment.go b/MCP/go/tools/repos/repos_get_pages_deployment.go index 0b33d26..14b080c 100644 --- a/MCP/go/tools/repos/repos_get_pages_deployment.go +++ b/MCP/go/tools/repos/repos_get_pages_deployment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_pages_deploymentHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: pages_deployment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages/deployments/%s%s", cfg.BaseURL, owner, repo, pages_deployment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/deployments/%s", cfg.BaseURL, owner, repo, pages_deployment_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_pages_deploymentHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pages_deployment_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_pages_deploymentHandler(cfg *config.APIConfig) func(ctx context.C } func CreateRepos_get_pages_deploymentTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_pages_deployments_pages_deployment_id", + tool := mcp.NewTool("get_repos_owner_repo_pages_deployments_deployment_id", mcp.WithDescription("Get the status of a GitHub Pages deployment"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_pages_health_check.go b/MCP/go/tools/repos/repos_get_pages_health_check.go index 6ade50d..bb88bce 100644 --- a/MCP/go/tools/repos/repos_get_pages_health_check.go +++ b/MCP/go/tools/repos/repos_get_pages_health_check.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_pages_health_checkHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages/health%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/health", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_pages_health_checkHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Pages_health_check if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_participation_stats.go b/MCP/go/tools/repos/repos_get_participation_stats.go index d122cf3..9f6f263 100644 --- a/MCP/go/tools/repos/repos_get_participation_stats.go +++ b/MCP/go/tools/repos/repos_get_participation_stats.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_participation_statsHandler(cfg *config.APIConfig) func(ctx contex if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/stats/participation%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/stats/participation", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_participation_statsHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Participation_stats if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_pull_request_review_protection.go b/MCP/go/tools/repos/repos_get_pull_request_review_protection.go index 8dc5550..b3519a9 100644 --- a/MCP/go/tools/repos/repos_get_pull_request_review_protection.go +++ b/MCP/go/tools/repos/repos_get_pull_request_review_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_pull_request_review_protectionHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_pull_request_reviews%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_pull_request_reviews", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_pull_request_review_protectionHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch_pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_pull_request_review_protectionHandler(cfg *config.APIConfig) func } func CreateRepos_get_pull_request_review_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required_pull_request_reviews", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Get pull request review protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_punch_card_stats.go b/MCP/go/tools/repos/repos_get_punch_card_stats.go index 0a2ec6b..272143d 100644 --- a/MCP/go/tools/repos/repos_get_punch_card_stats.go +++ b/MCP/go/tools/repos/repos_get_punch_card_stats.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_punch_card_statsHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/stats/punch_card%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/stats/punch_card", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_readme.go b/MCP/go/tools/repos/repos_get_readme.go index 5c167f5..34a28f5 100644 --- a/MCP/go/tools/repos/repos_get_readme.go +++ b/MCP/go/tools/repos/repos_get_readme.go @@ -39,34 +39,6 @@ func Repos_get_readmeHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Repos_get_readmeHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -104,7 +79,7 @@ func Repos_get_readmeHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Content_file if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_readme_in_directory.go b/MCP/go/tools/repos/repos_get_readme_in_directory.go index b4e313c..9cc9621 100644 --- a/MCP/go/tools/repos/repos_get_readme_in_directory.go +++ b/MCP/go/tools/repos/repos_get_readme_in_directory.go @@ -47,34 +47,6 @@ func Repos_get_readme_in_directoryHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["ref"]; ok { queryParams = append(queryParams, fmt.Sprintf("ref=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Repos_get_readme_in_directoryHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Repos_get_readme_in_directoryHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Content_file if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_release.go b/MCP/go/tools/repos/repos_get_release.go index 515f6cf..def21da 100644 --- a/MCP/go/tools/repos/repos_get_release.go +++ b/MCP/go/tools/repos/repos_get_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_releaseHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: release_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/%s%s", cfg.BaseURL, owner, repo, release_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/%s", cfg.BaseURL, owner, repo, release_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_release_asset.go b/MCP/go/tools/repos/repos_get_release_asset.go index bc40d83..ee52cce 100644 --- a/MCP/go/tools/repos/repos_get_release_asset.go +++ b/MCP/go/tools/repos/repos_get_release_asset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_release_assetHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: asset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/assets/%s%s", cfg.BaseURL, owner, repo, asset_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/assets/%s", cfg.BaseURL, owner, repo, asset_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_release_assetHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Release_asset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_release_by_tag.go b/MCP/go/tools/repos/repos_get_release_by_tag.go index 39a56a4..27063d4 100644 --- a/MCP/go/tools/repos/repos_get_release_by_tag.go +++ b/MCP/go/tools/repos/repos_get_release_by_tag.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_release_by_tagHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: tag"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/releases/tags/%s%s", cfg.BaseURL, owner, repo, tag, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/tags/%s", cfg.BaseURL, owner, repo, tag) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_repo_rule_suite.go b/MCP/go/tools/repos/repos_get_repo_rule_suite.go index fb1f416..4ffe705 100644 --- a/MCP/go/tools/repos/repos_get_repo_rule_suite.go +++ b/MCP/go/tools/repos/repos_get_repo_rule_suite.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_repo_rule_suiteHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: rule_suite_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/rulesets/rule-suites/%s%s", cfg.BaseURL, owner, repo, rule_suite_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/rulesets/rule-suites/%s", cfg.BaseURL, owner, repo, rule_suite_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_repo_rule_suiteHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Rule_suite if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_repo_rule_suites.go b/MCP/go/tools/repos/repos_get_repo_rule_suites.go index b3b9565..1fa7198 100644 --- a/MCP/go/tools/repos/repos_get_repo_rule_suites.go +++ b/MCP/go/tools/repos/repos_get_repo_rule_suites.go @@ -54,34 +54,6 @@ func Repos_get_repo_rule_suitesHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -91,17 +63,20 @@ func Repos_get_repo_rule_suitesHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_repo_ruleset.go b/MCP/go/tools/repos/repos_get_repo_ruleset.go index ff52893..8a3ae03 100644 --- a/MCP/go/tools/repos/repos_get_repo_ruleset.go +++ b/MCP/go/tools/repos/repos_get_repo_ruleset.go @@ -47,34 +47,6 @@ func Repos_get_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["includes_parents"]; ok { queryParams = append(queryParams, fmt.Sprintf("includes_parents=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Repos_get_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Repos_get_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_repo_ruleset_history.go b/MCP/go/tools/repos/repos_get_repo_ruleset_history.go index b0c4803..9f8b9e6 100644 --- a/MCP/go/tools/repos/repos_get_repo_ruleset_history.go +++ b/MCP/go/tools/repos/repos_get_repo_ruleset_history.go @@ -50,34 +50,6 @@ func Repos_get_repo_ruleset_historyHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_get_repo_ruleset_historyHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_get_repo_ruleset_historyHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Ruleset_version if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_repo_ruleset_version.go b/MCP/go/tools/repos/repos_get_repo_ruleset_version.go index 387304c..789ccdb 100644 --- a/MCP/go/tools/repos/repos_get_repo_ruleset_version.go +++ b/MCP/go/tools/repos/repos_get_repo_ruleset_version.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_get_repo_ruleset_versionHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: version_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/rulesets/%s/history/%s%s", cfg.BaseURL, owner, repo, ruleset_id, version_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/rulesets/%s/history/%s", cfg.BaseURL, owner, repo, ruleset_id, version_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Repos_get_repo_ruleset_versionHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Ruleset_version_with_state if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Repos_get_repo_ruleset_versionHandler(cfg *config.APIConfig) func(ctx conte } func CreateRepos_get_repo_ruleset_versionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_rulesets_ruleset_id_history_version_id", + tool := mcp.NewTool("get_repos_owner_repo_rulesets_ruleset_id_history_version", mcp.WithDescription("Get repository ruleset version"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_repo_rulesets.go b/MCP/go/tools/repos/repos_get_repo_rulesets.go index 4efa143..9eb4907 100644 --- a/MCP/go/tools/repos/repos_get_repo_rulesets.go +++ b/MCP/go/tools/repos/repos_get_repo_rulesets.go @@ -48,34 +48,6 @@ func Repos_get_repo_rulesetsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["targets"]; ok { queryParams = append(queryParams, fmt.Sprintf("targets=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Repos_get_repo_rulesetsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -113,7 +88,7 @@ func Repos_get_repo_rulesetsHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_status_checks_protection.go b/MCP/go/tools/repos/repos_get_status_checks_protection.go index a363ae9..84e4c35 100644 --- a/MCP/go/tools/repos/repos_get_status_checks_protection.go +++ b/MCP/go/tools/repos/repos_get_status_checks_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_status_checks_protectionHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_status_checks_protectionHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Status_check_policy if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_status_checks_protectionHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_get_status_checks_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required_status_checks", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Get status checks protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_teams_with_access_to_protected_branch.go b/MCP/go/tools/repos/repos_get_teams_with_access_to_protected_branch.go index ae07c37..58e64f9 100644 --- a/MCP/go/tools/repos/repos_get_teams_with_access_to_protected_branch.go +++ b/MCP/go/tools/repos/repos_get_teams_with_access_to_protected_branch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_teams_with_access_to_protected_branchHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_teams_with_access_to_protected_branchHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_teams_with_access_to_protected_branchHandler(cfg *config.APIConfi } func CreateRepos_get_teams_with_access_to_protected_branchTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_restrictions_teams", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_restrictions", mcp.WithDescription("Get teams with access to the protected branch"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_top_paths.go b/MCP/go/tools/repos/repos_get_top_paths.go index c3b5d9f..8e82422 100644 --- a/MCP/go/tools/repos/repos_get_top_paths.go +++ b/MCP/go/tools/repos/repos_get_top_paths.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_top_pathsHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/traffic/popular/paths%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/traffic/popular/paths", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_top_pathsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Content_traffic if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_top_referrers.go b/MCP/go/tools/repos/repos_get_top_referrers.go index bcbc1e5..ca9b935 100644 --- a/MCP/go/tools/repos/repos_get_top_referrers.go +++ b/MCP/go/tools/repos/repos_get_top_referrers.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_get_top_referrersHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/traffic/popular/referrers%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/traffic/popular/referrers", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_get_top_referrersHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Referrer_traffic if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_users_with_access_to_protected_branch.go b/MCP/go/tools/repos/repos_get_users_with_access_to_protected_branch.go index 608b093..a1e0b15 100644 --- a/MCP/go/tools/repos/repos_get_users_with_access_to_protected_branch.go +++ b/MCP/go/tools/repos/repos_get_users_with_access_to_protected_branch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_users_with_access_to_protected_branchHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_users_with_access_to_protected_branchHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_get_users_with_access_to_protected_branchHandler(cfg *config.APIConfi } func CreateRepos_get_users_with_access_to_protected_branchTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_restrictions_users", + tool := mcp.NewTool("get_repos_owner_repo_branches_branch_protection_restrictions", mcp.WithDescription("Get users with access to the protected branch"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_get_views.go b/MCP/go/tools/repos/repos_get_views.go index 7192095..5e61574 100644 --- a/MCP/go/tools/repos/repos_get_views.go +++ b/MCP/go/tools/repos/repos_get_views.go @@ -39,34 +39,6 @@ func Repos_get_viewsHandler(cfg *config.APIConfig) func(ctx context.Context, req if val, ok := args["per"]; ok { queryParams = append(queryParams, fmt.Sprintf("per=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -76,17 +48,20 @@ func Repos_get_viewsHandler(cfg *config.APIConfig) func(ctx context.Context, req if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -104,7 +79,7 @@ func Repos_get_viewsHandler(cfg *config.APIConfig) func(ctx context.Context, req return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_View_traffic if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_webhook.go b/MCP/go/tools/repos/repos_get_webhook.go index e5dbd8a..68a707a 100644 --- a/MCP/go/tools/repos/repos_get_webhook.go +++ b/MCP/go/tools/repos/repos_get_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_get_webhook_config_for_repo.go b/MCP/go/tools/repos/repos_get_webhook_config_for_repo.go index 540e84c..8fc2e06 100644 --- a/MCP/go/tools/repos/repos_get_webhook_config_for_repo.go +++ b/MCP/go/tools/repos/repos_get_webhook_config_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_get_webhook_config_for_repoHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/config%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/config", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_get_webhook_config_for_repoHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Webhook_config if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_get_webhook_delivery.go b/MCP/go/tools/repos/repos_get_webhook_delivery.go index 37e6692..646d336 100644 --- a/MCP/go/tools/repos/repos_get_webhook_delivery.go +++ b/MCP/go/tools/repos/repos_get_webhook_delivery.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: delivery_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/deliveries/%s%s", cfg.BaseURL, owner, repo, hook_id, delivery_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/deliveries/%s", cfg.BaseURL, owner, repo, hook_id, delivery_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Repos_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Hook_delivery if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Repos_get_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx context.C } func CreateRepos_get_webhook_deliveryTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_hooks_hook_id_deliveries_delivery_id", + tool := mcp.NewTool("get_repos_owner_repo_hooks_hook_id_deliveries_delivery", mcp.WithDescription("Get a delivery for a repository webhook"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_list_activities.go b/MCP/go/tools/repos/repos_list_activities.go index 2e6e89b..993a18b 100644 --- a/MCP/go/tools/repos/repos_list_activities.go +++ b/MCP/go/tools/repos/repos_list_activities.go @@ -60,34 +60,6 @@ func Repos_list_activitiesHandler(cfg *config.APIConfig) func(ctx context.Contex if val, ok := args["activity_type"]; ok { queryParams = append(queryParams, fmt.Sprintf("activity_type=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -97,17 +69,20 @@ func Repos_list_activitiesHandler(cfg *config.APIConfig) func(ctx context.Contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +100,7 @@ func Repos_list_activitiesHandler(cfg *config.APIConfig) func(ctx context.Contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Activity + var result []models.Activity if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_attestations.go b/MCP/go/tools/repos/repos_list_attestations.go index 9611422..f218cc5 100644 --- a/MCP/go/tools/repos/repos_list_attestations.go +++ b/MCP/go/tools/repos/repos_list_attestations.go @@ -56,34 +56,6 @@ func Repos_list_attestationsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["predicate_type"]; ok { queryParams = append(queryParams, fmt.Sprintf("predicate_type=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -93,17 +65,20 @@ func Repos_list_attestationsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_list_autolinks.go b/MCP/go/tools/repos/repos_list_autolinks.go index 2b1efff..935ba29 100644 --- a/MCP/go/tools/repos/repos_list_autolinks.go +++ b/MCP/go/tools/repos/repos_list_autolinks.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_list_autolinksHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/autolinks%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/autolinks", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_list_autolinksHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Autolink + var result []models.Autolink if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_branches.go b/MCP/go/tools/repos/repos_list_branches.go index 0306039..dffbff0 100644 --- a/MCP/go/tools/repos/repos_list_branches.go +++ b/MCP/go/tools/repos/repos_list_branches.go @@ -45,34 +45,6 @@ func Repos_list_branchesHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Repos_list_branchesHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Repos_list_branchesHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Short_branch if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_branches_for_head_commit.go b/MCP/go/tools/repos/repos_list_branches_for_head_commit.go index 18bf59a..f8dd7f7 100644 --- a/MCP/go/tools/repos/repos_list_branches_for_head_commit.go +++ b/MCP/go/tools/repos/repos_list_branches_for_head_commit.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_list_branches_for_head_commitHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: commit_sha"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/commits/%s/branches-where-head%s", cfg.BaseURL, owner, repo, commit_sha, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/commits/%s/branches-where-head", cfg.BaseURL, owner, repo, commit_sha) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_list_branches_for_head_commitHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Branch_short if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_collaborators.go b/MCP/go/tools/repos/repos_list_collaborators.go index fa7a669..e86217d 100644 --- a/MCP/go/tools/repos/repos_list_collaborators.go +++ b/MCP/go/tools/repos/repos_list_collaborators.go @@ -48,34 +48,6 @@ func Repos_list_collaboratorsHandler(cfg *config.APIConfig) func(ctx context.Con if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Repos_list_collaboratorsHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -113,7 +88,7 @@ func Repos_list_collaboratorsHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Collaborator + var result []models.Collaborator if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_comments_for_commit.go b/MCP/go/tools/repos/repos_list_comments_for_commit.go index 4cb4283..fcd83d4 100644 --- a/MCP/go/tools/repos/repos_list_comments_for_commit.go +++ b/MCP/go/tools/repos/repos_list_comments_for_commit.go @@ -50,34 +50,6 @@ func Repos_list_comments_for_commitHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_comments_for_commitHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_list_comments_for_commitHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Commit_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_commit_comments_for_repo.go b/MCP/go/tools/repos/repos_list_commit_comments_for_repo.go index 47b5624..f31870c 100644 --- a/MCP/go/tools/repos/repos_list_commit_comments_for_repo.go +++ b/MCP/go/tools/repos/repos_list_commit_comments_for_repo.go @@ -42,34 +42,6 @@ func Repos_list_commit_comments_for_repoHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_commit_comments_for_repoHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_commit_comments_for_repoHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Commit_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_commit_statuses_for_ref.go b/MCP/go/tools/repos/repos_list_commit_statuses_for_ref.go index f58ed9f..1c8e77c 100644 --- a/MCP/go/tools/repos/repos_list_commit_statuses_for_ref.go +++ b/MCP/go/tools/repos/repos_list_commit_statuses_for_ref.go @@ -50,34 +50,6 @@ func Repos_list_commit_statuses_for_refHandler(cfg *config.APIConfig) func(ctx c if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_commit_statuses_for_refHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_list_commit_statuses_for_refHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Status + var result []models.Status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_commits.go b/MCP/go/tools/repos/repos_list_commits.go index 7218b89..230b29b 100644 --- a/MCP/go/tools/repos/repos_list_commits.go +++ b/MCP/go/tools/repos/repos_list_commits.go @@ -60,34 +60,6 @@ func Repos_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -97,17 +69,20 @@ func Repos_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +100,7 @@ func Repos_list_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Commit + var result []models.Commit if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_contributors.go b/MCP/go/tools/repos/repos_list_contributors.go index e12b778..b9eaa00 100644 --- a/MCP/go/tools/repos/repos_list_contributors.go +++ b/MCP/go/tools/repos/repos_list_contributors.go @@ -45,34 +45,6 @@ func Repos_list_contributorsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Repos_list_contributorsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Repos_list_contributorsHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Contributor + var result []models.Contributor if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_custom_deployment_rule_integrations.go b/MCP/go/tools/repos/repos_list_custom_deployment_rule_integrations.go index f575ef2..83e3795 100644 --- a/MCP/go/tools/repos/repos_list_custom_deployment_rule_integrations.go +++ b/MCP/go/tools/repos/repos_list_custom_deployment_rule_integrations.go @@ -50,34 +50,6 @@ func Repos_list_custom_deployment_rule_integrationsHandler(cfg *config.APIConfig if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_custom_deployment_rule_integrationsHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -131,7 +106,7 @@ func Repos_list_custom_deployment_rule_integrationsHandler(cfg *config.APIConfig } func CreateRepos_list_custom_deployment_rule_integrationsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_deployment_protection_rules_apps", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name", mcp.WithDescription("List custom deployment rule integrations available for an environment"), mcp.WithString("environment_name", mcp.Required(), mcp.Description("The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_list_deploy_keys.go b/MCP/go/tools/repos/repos_list_deploy_keys.go index 342cd6d..53b47b6 100644 --- a/MCP/go/tools/repos/repos_list_deploy_keys.go +++ b/MCP/go/tools/repos/repos_list_deploy_keys.go @@ -42,34 +42,6 @@ func Repos_list_deploy_keysHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_deploy_keysHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_deploy_keysHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Deploy_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_deployment_branch_policies.go b/MCP/go/tools/repos/repos_list_deployment_branch_policies.go index d361dda..66576df 100644 --- a/MCP/go/tools/repos/repos_list_deployment_branch_policies.go +++ b/MCP/go/tools/repos/repos_list_deployment_branch_policies.go @@ -50,34 +50,6 @@ func Repos_list_deployment_branch_policiesHandler(cfg *config.APIConfig) func(ct if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_deployment_branch_policiesHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -131,7 +106,7 @@ func Repos_list_deployment_branch_policiesHandler(cfg *config.APIConfig) func(ct } func CreateRepos_list_deployment_branch_policiesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name_deployment-branch-policies", + tool := mcp.NewTool("get_repos_owner_repo_environments_environment_name", mcp.WithDescription("List deployment branch policies"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_list_deployment_statuses.go b/MCP/go/tools/repos/repos_list_deployment_statuses.go index 4d763cc..8135955 100644 --- a/MCP/go/tools/repos/repos_list_deployment_statuses.go +++ b/MCP/go/tools/repos/repos_list_deployment_statuses.go @@ -50,34 +50,6 @@ func Repos_list_deployment_statusesHandler(cfg *config.APIConfig) func(ctx conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_deployment_statusesHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_list_deployment_statusesHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Deployment_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -131,7 +106,7 @@ func Repos_list_deployment_statusesHandler(cfg *config.APIConfig) func(ctx conte } func CreateRepos_list_deployment_statusesTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_deployments_deployment_id_statuses", + tool := mcp.NewTool("get_repos_owner_repo_deployments_deployment_id_statuses_2", mcp.WithDescription("List deployment statuses"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_list_deployments.go b/MCP/go/tools/repos/repos_list_deployments.go index 7903b9d..db1063c 100644 --- a/MCP/go/tools/repos/repos_list_deployments.go +++ b/MCP/go/tools/repos/repos_list_deployments.go @@ -54,34 +54,6 @@ func Repos_list_deploymentsHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -91,17 +63,20 @@ func Repos_list_deploymentsHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +94,7 @@ func Repos_list_deploymentsHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Deployment + var result []models.Deployment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_for_authenticated_user.go b/MCP/go/tools/repos/repos_list_for_authenticated_user.go index ec2fd2d..9dcafa1 100644 --- a/MCP/go/tools/repos/repos_list_for_authenticated_user.go +++ b/MCP/go/tools/repos/repos_list_for_authenticated_user.go @@ -47,34 +47,6 @@ func Repos_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["before"]; ok { queryParams = append(queryParams, fmt.Sprintf("before=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Repos_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Repos_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Repository + var result []models.Repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_for_org.go b/MCP/go/tools/repos/repos_list_for_org.go index 950eaa3..2ac2304 100644 --- a/MCP/go/tools/repos/repos_list_for_org.go +++ b/MCP/go/tools/repos/repos_list_for_org.go @@ -43,34 +43,6 @@ func Repos_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -80,17 +52,20 @@ func Repos_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -108,7 +83,7 @@ func Repos_list_for_orgHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_for_user.go b/MCP/go/tools/repos/repos_list_for_user.go index f189e1c..eafa6cf 100644 --- a/MCP/go/tools/repos/repos_list_for_user.go +++ b/MCP/go/tools/repos/repos_list_for_user.go @@ -43,34 +43,6 @@ func Repos_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -80,17 +52,20 @@ func Repos_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -108,7 +83,7 @@ func Repos_list_for_userHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_forks.go b/MCP/go/tools/repos/repos_list_forks.go index b62ad73..b48ea41 100644 --- a/MCP/go/tools/repos/repos_list_forks.go +++ b/MCP/go/tools/repos/repos_list_forks.go @@ -45,34 +45,6 @@ func Repos_list_forksHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Repos_list_forksHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Repos_list_forksHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_invitations.go b/MCP/go/tools/repos/repos_list_invitations.go index 908b96c..619be9d 100644 --- a/MCP/go/tools/repos/repos_list_invitations.go +++ b/MCP/go/tools/repos/repos_list_invitations.go @@ -42,34 +42,6 @@ func Repos_list_invitationsHandler(cfg *config.APIConfig) func(ctx context.Conte if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_invitationsHandler(cfg *config.APIConfig) func(ctx context.Conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_invitationsHandler(cfg *config.APIConfig) func(ctx context.Conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_invitations_for_authenticated_user.go b/MCP/go/tools/repos/repos_list_invitations_for_authenticated_user.go index 25d183a..6875fa7 100644 --- a/MCP/go/tools/repos/repos_list_invitations_for_authenticated_user.go +++ b/MCP/go/tools/repos/repos_list_invitations_for_authenticated_user.go @@ -26,34 +26,6 @@ func Repos_list_invitations_for_authenticated_userHandler(cfg *config.APIConfig) if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Repos_list_invitations_for_authenticated_userHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Repos_list_invitations_for_authenticated_userHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_languages.go b/MCP/go/tools/repos/repos_list_languages.go index 16bf295..f468de1 100644 --- a/MCP/go/tools/repos/repos_list_languages.go +++ b/MCP/go/tools/repos/repos_list_languages.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_list_languagesHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/languages%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/languages", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_list_pages_builds.go b/MCP/go/tools/repos/repos_list_pages_builds.go index ad168fe..0b637f0 100644 --- a/MCP/go/tools/repos/repos_list_pages_builds.go +++ b/MCP/go/tools/repos/repos_list_pages_builds.go @@ -42,34 +42,6 @@ func Repos_list_pages_buildsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_pages_buildsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_pages_buildsHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Page_build if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_public.go b/MCP/go/tools/repos/repos_list_public.go index 7603888..764c781 100644 --- a/MCP/go/tools/repos/repos_list_public.go +++ b/MCP/go/tools/repos/repos_list_public.go @@ -23,34 +23,6 @@ func Repos_list_publicHandler(cfg *config.APIConfig) func(ctx context.Context, r if val, ok := args["since"]; ok { queryParams = append(queryParams, fmt.Sprintf("since=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -60,17 +32,20 @@ func Repos_list_publicHandler(cfg *config.APIConfig) func(ctx context.Context, r if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -88,7 +63,7 @@ func Repos_list_publicHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_pull_requests_associated_with_commit.go b/MCP/go/tools/repos/repos_list_pull_requests_associated_with_commit.go index 6f3b08d..57e914c 100644 --- a/MCP/go/tools/repos/repos_list_pull_requests_associated_with_commit.go +++ b/MCP/go/tools/repos/repos_list_pull_requests_associated_with_commit.go @@ -50,34 +50,6 @@ func Repos_list_pull_requests_associated_with_commitHandler(cfg *config.APIConfi if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_pull_requests_associated_with_commitHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_list_pull_requests_associated_with_commitHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Pull_request_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_release_assets.go b/MCP/go/tools/repos/repos_list_release_assets.go index 30da8ab..1823ebf 100644 --- a/MCP/go/tools/repos/repos_list_release_assets.go +++ b/MCP/go/tools/repos/repos_list_release_assets.go @@ -50,34 +50,6 @@ func Repos_list_release_assetsHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_release_assetsHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_list_release_assetsHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Release_asset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_releases.go b/MCP/go/tools/repos/repos_list_releases.go index ac3af59..3a23e38 100644 --- a/MCP/go/tools/repos/repos_list_releases.go +++ b/MCP/go/tools/repos/repos_list_releases.go @@ -42,34 +42,6 @@ func Repos_list_releasesHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_releasesHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_releasesHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Release + var result []models.Release if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_tag_protection.go b/MCP/go/tools/repos/repos_list_tag_protection.go index 7706e6b..9eaa649 100644 --- a/MCP/go/tools/repos/repos_list_tag_protection.go +++ b/MCP/go/tools/repos/repos_list_tag_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_list_tag_protectionHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/tags/protection%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/tags/protection", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_list_tag_protectionHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Tag_protection if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_tags.go b/MCP/go/tools/repos/repos_list_tags.go index 9c6e51a..87bf21f 100644 --- a/MCP/go/tools/repos/repos_list_tags.go +++ b/MCP/go/tools/repos/repos_list_tags.go @@ -42,34 +42,6 @@ func Repos_list_tagsHandler(cfg *config.APIConfig) func(ctx context.Context, req if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_tagsHandler(cfg *config.APIConfig) func(ctx context.Context, req if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_tagsHandler(cfg *config.APIConfig) func(ctx context.Context, req return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Tag + var result []models.Tag if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_teams.go b/MCP/go/tools/repos/repos_list_teams.go index cc74f8e..ac6917c 100644 --- a/MCP/go/tools/repos/repos_list_teams.go +++ b/MCP/go/tools/repos/repos_list_teams.go @@ -42,34 +42,6 @@ func Repos_list_teamsHandler(cfg *config.APIConfig) func(ctx context.Context, re if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_teamsHandler(cfg *config.APIConfig) func(ctx context.Context, re if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_teamsHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_webhook_deliveries.go b/MCP/go/tools/repos/repos_list_webhook_deliveries.go index f34aba2..7d95759 100644 --- a/MCP/go/tools/repos/repos_list_webhook_deliveries.go +++ b/MCP/go/tools/repos/repos_list_webhook_deliveries.go @@ -50,34 +50,6 @@ func Repos_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["cursor"]; ok { queryParams = append(queryParams, fmt.Sprintf("cursor=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Repos_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Repos_list_webhook_deliveriesHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Hook_delivery_item if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_list_webhooks.go b/MCP/go/tools/repos/repos_list_webhooks.go index 912bc34..3f069cb 100644 --- a/MCP/go/tools/repos/repos_list_webhooks.go +++ b/MCP/go/tools/repos/repos_list_webhooks.go @@ -42,34 +42,6 @@ func Repos_list_webhooksHandler(cfg *config.APIConfig) func(ctx context.Context, if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Repos_list_webhooksHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Repos_list_webhooksHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Hook + var result []models.Hook if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_merge.go b/MCP/go/tools/repos/repos_merge.go index 915b21f..7433a58 100644 --- a/MCP/go/tools/repos/repos_merge.go +++ b/MCP/go/tools/repos/repos_merge.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_mergeHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_mergeHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/merges%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/merges", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,9 +108,9 @@ func CreateRepos_mergeTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Merge a branch"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("base", mcp.Required(), mcp.Description("Input parameter: The name of the base branch that the head will be merged into.")), mcp.WithString("commit_message", mcp.Description("Input parameter: Commit message to use for the merge commit. If omitted, a default message will be used.")), mcp.WithString("head", mcp.Required(), mcp.Description("Input parameter: The head to merge. This can be a branch name or a commit SHA1.")), - mcp.WithString("base", mcp.Required(), mcp.Description("Input parameter: The name of the base branch that the head will be merged into.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_merge_upstream.go b/MCP/go/tools/repos/repos_merge_upstream.go index eeb07d3..5db5f83 100644 --- a/MCP/go/tools/repos/repos_merge_upstream.go +++ b/MCP/go/tools/repos/repos_merge_upstream.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_merge_upstreamHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_merge_upstreamHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/merge-upstream%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/merge-upstream", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_merge_upstreamHandler(cfg *config.APIConfig) func(ctx context.Context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Merged_upstream if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_ping_webhook.go b/MCP/go/tools/repos/repos_ping_webhook.go index 0d4038c..b9bd974 100644 --- a/MCP/go/tools/repos/repos_ping_webhook.go +++ b/MCP/go/tools/repos/repos_ping_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_ping_webhookHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/pings%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/pings", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_redeliver_webhook_delivery.go b/MCP/go/tools/repos/repos_redeliver_webhook_delivery.go index a79db36..b200554 100644 --- a/MCP/go/tools/repos/repos_redeliver_webhook_delivery.go +++ b/MCP/go/tools/repos/repos_redeliver_webhook_delivery.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Repos_redeliver_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: delivery_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/deliveries/%s/attempts%s", cfg.BaseURL, owner, repo, hook_id, delivery_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/deliveries/%s/attempts", cfg.BaseURL, owner, repo, hook_id, delivery_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Repos_redeliver_webhook_deliveryHandler(cfg *config.APIConfig) func(ctx con } func CreateRepos_redeliver_webhook_deliveryTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_hooks_hook_id_deliveries_delivery_id_attempts", + tool := mcp.NewTool("post_repos_owner_repo_hooks_hook_id_deliveries_delivery", mcp.WithDescription("Redeliver a delivery for a repository webhook"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_remove_app_access_restrictions.go b/MCP/go/tools/repos/repos_remove_app_access_restrictions.go index c64d20d..bea1b71 100644 --- a/MCP/go/tools/repos/repos_remove_app_access_restrictions.go +++ b/MCP/go/tools/repos/repos_remove_app_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_remove_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_remove_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_remove_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Integration + var result []models.Integration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_remove_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx } func CreateRepos_remove_app_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_restrictions_apps", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Remove app access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_remove_collaborator.go b/MCP/go/tools/repos/repos_remove_collaborator.go index d86b73b..ff12b61 100644 --- a/MCP/go/tools/repos/repos_remove_collaborator.go +++ b/MCP/go/tools/repos/repos_remove_collaborator.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_remove_collaboratorHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s%s", cfg.BaseURL, owner, repo, username, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/collaborators/%s", cfg.BaseURL, owner, repo, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_remove_status_check_contexts.go b/MCP/go/tools/repos/repos_remove_status_check_contexts.go index 032e7ec..9b0e1f6 100644 --- a/MCP/go/tools/repos/repos_remove_status_check_contexts.go +++ b/MCP/go/tools/repos/repos_remove_status_check_contexts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_remove_status_check_contextsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Repos_remove_status_check_contextsHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Repos_remove_status_check_contextsHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_remove_status_check_contextsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required_status_checks_contexts", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Remove status check contexts"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_remove_status_check_protection.go b/MCP/go/tools/repos/repos_remove_status_check_protection.go index 8cf6cd6..254fd4e 100644 --- a/MCP/go/tools/repos/repos_remove_status_check_protection.go +++ b/MCP/go/tools/repos/repos_remove_status_check_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_remove_status_check_protectionHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Repos_remove_status_check_protectionHandler(cfg *config.APIConfig) func(ctx } func CreateRepos_remove_status_check_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required_status_checks", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Remove status check protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_remove_team_access_restrictions.go b/MCP/go/tools/repos/repos_remove_team_access_restrictions.go index 8539135..80be7ac 100644 --- a/MCP/go/tools/repos/repos_remove_team_access_restrictions.go +++ b/MCP/go/tools/repos/repos_remove_team_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_remove_team_access_restrictionsHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Repos_remove_team_access_restrictionsHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_remove_team_access_restrictionsHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_remove_team_access_restrictionsHandler(cfg *config.APIConfig) func(ct } func CreateRepos_remove_team_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_restrictions_teams", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Remove team access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_remove_user_access_restrictions.go b/MCP/go/tools/repos/repos_remove_user_access_restrictions.go index 0374bb2..e390c80 100644 --- a/MCP/go/tools/repos/repos_remove_user_access_restrictions.go +++ b/MCP/go/tools/repos/repos_remove_user_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_remove_user_access_restrictionsHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_remove_user_access_restrictionsHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_remove_user_access_restrictionsHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_remove_user_access_restrictionsHandler(cfg *config.APIConfig) func(ct } func CreateRepos_remove_user_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection_restrictions_users", + tool := mcp.NewTool("delete_repos_owner_repo_branches_branch_protection", mcp.WithDescription("Remove user access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_rename_branch.go b/MCP/go/tools/repos/repos_rename_branch.go index 1c9d691..5268bd2 100644 --- a/MCP/go/tools/repos/repos_rename_branch.go +++ b/MCP/go/tools/repos/repos_rename_branch.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_rename_branchHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_rename_branchHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/rename%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/rename", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_rename_branchHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Branch_with_protection if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_replace_all_topics.go b/MCP/go/tools/repos/repos_replace_all_topics.go index 1dadcf1..892fd8a 100644 --- a/MCP/go/tools/repos/repos_replace_all_topics.go +++ b/MCP/go/tools/repos/repos_replace_all_topics.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_replace_all_topicsHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_replace_all_topicsHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/topics%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/topics", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_request_pages_build.go b/MCP/go/tools/repos/repos_request_pages_build.go index 9fea6ae..db32e73 100644 --- a/MCP/go/tools/repos/repos_request_pages_build.go +++ b/MCP/go/tools/repos/repos_request_pages_build.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Repos_request_pages_buildHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/pages/builds%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages/builds", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Repos_request_pages_buildHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Page_build_status if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_set_admin_branch_protection.go b/MCP/go/tools/repos/repos_set_admin_branch_protection.go index fdd3d7b..32f2c09 100644 --- a/MCP/go/tools/repos/repos_set_admin_branch_protection.go +++ b/MCP/go/tools/repos/repos_set_admin_branch_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_set_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/enforce_admins%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/enforce_admins", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Repos_set_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch_admin_enforced if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Repos_set_admin_branch_protectionHandler(cfg *config.APIConfig) func(ctx co } func CreateRepos_set_admin_branch_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_enforce_admins", + tool := mcp.NewTool("post_repos_owner_repo_branches_branch_protection_enforce", mcp.WithDescription("Set admin branch protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_set_app_access_restrictions.go b/MCP/go/tools/repos/repos_set_app_access_restrictions.go index 847a240..44249a1 100644 --- a/MCP/go/tools/repos/repos_set_app_access_restrictions.go +++ b/MCP/go/tools/repos/repos_set_app_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_set_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_set_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/apps", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_set_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Integration + var result []models.Integration if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_set_app_access_restrictionsHandler(cfg *config.APIConfig) func(ctx co } func CreateRepos_set_app_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_restrictions_apps", + tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_restrictions", mcp.WithDescription("Set app access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_set_status_check_contexts.go b/MCP/go/tools/repos/repos_set_status_check_contexts.go index 9bd4383..2c95167 100644 --- a/MCP/go/tools/repos/repos_set_status_check_contexts.go +++ b/MCP/go/tools/repos/repos_set_status_check_contexts.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_set_status_check_contextsHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Repos_set_status_check_contextsHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks/contexts", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -143,7 +112,7 @@ func Repos_set_status_check_contextsHandler(cfg *config.APIConfig) func(ctx cont } func CreateRepos_set_status_check_contextsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_required_status_checks_contexts", + tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Set status check contexts"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_set_team_access_restrictions.go b/MCP/go/tools/repos/repos_set_team_access_restrictions.go index 66b0a1f..ff782b3 100644 --- a/MCP/go/tools/repos/repos_set_team_access_restrictions.go +++ b/MCP/go/tools/repos/repos_set_team_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_set_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -93,23 +59,26 @@ func Repos_set_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/teams", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_set_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_set_team_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_set_team_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_restrictions_teams", + tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_restrictions", mcp.WithDescription("Set team access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_set_user_access_restrictions.go b/MCP/go/tools/repos/repos_set_user_access_restrictions.go index c804b07..53421fe 100644 --- a/MCP/go/tools/repos/repos_set_user_access_restrictions.go +++ b/MCP/go/tools/repos/repos_set_user_access_restrictions.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_set_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_set_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/restrictions/users", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_set_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_set_user_access_restrictionsHandler(cfg *config.APIConfig) func(ctx c } func CreateRepos_set_user_access_restrictionsTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_restrictions_users", + tool := mcp.NewTool("put_repos_owner_repo_branches_branch_protection_restrictions", mcp.WithDescription("Set user access restrictions"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_test_push_webhook.go b/MCP/go/tools/repos/repos_test_push_webhook.go index 4b28b43..b07129c 100644 --- a/MCP/go/tools/repos/repos_test_push_webhook.go +++ b/MCP/go/tools/repos/repos_test_push_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Repos_test_push_webhookHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/tests%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/tests", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/repos/repos_transfer.go b/MCP/go/tools/repos/repos_transfer.go index 9a07f5c..ae3034c 100644 --- a/MCP/go/tools/repos/repos_transfer.go +++ b/MCP/go/tools/repos/repos_transfer.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_transferHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_transferHandler(cfg *config.APIConfig) func(ctx context.Context, requ if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/transfer%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/transfer", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,9 +108,9 @@ func CreateRepos_transferTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Transfer a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), + mcp.WithString("new_owner", mcp.Required(), mcp.Description("Input parameter: The username or organization name the repository will be transferred to.")), mcp.WithArray("team_ids", mcp.Description("Input parameter: ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.")), mcp.WithString("new_name", mcp.Description("Input parameter: The new name to be given to the repository.")), - mcp.WithString("new_owner", mcp.Required(), mcp.Description("Input parameter: The username or organization name the repository will be transferred to.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update.go b/MCP/go/tools/repos/repos_update.go index f5de896..738c371 100644 --- a/MCP/go/tools/repos/repos_update.go +++ b/MCP/go/tools/repos/repos_update.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_updateHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Full_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,31 +108,31 @@ func CreateRepos_updateTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update a repository"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithBoolean("web_commit_signoff_required", mcp.Description("Input parameter: Either `true` to require contributors to sign off on web-based commits, or `false` to not require contributors to sign off on web-based commits.")), - mcp.WithBoolean("allow_auto_merge", mcp.Description("Input parameter: Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.")), + mcp.WithBoolean("allow_squash_merge", mcp.Description("Input parameter: Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.")), + mcp.WithString("description", mcp.Description("Input parameter: A short description of the repository.")), + mcp.WithString("homepage", mcp.Description("Input parameter: A URL with more information about the repository.")), mcp.WithBoolean("private", mcp.Description("Input parameter: Either `true` to make the repository private or `false` to make it public. Default: `false`. \n**Note**: You will get a `422` error if the organization restricts [changing repository visibility](https://docs.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private.")), mcp.WithBoolean("use_squash_pr_title_as_default", mcp.Description("Input parameter: Either `true` to allow squash-merge commits to use pull request title, or `false` to use commit message. **This property is closing down. Please use `squash_merge_commit_title` instead.")), - mcp.WithBoolean("has_projects", mcp.Description("Input parameter: Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.")), - mcp.WithBoolean("is_template", mcp.Description("Input parameter: Either `true` to make this repo available as a template repository or `false` to prevent it.")), - mcp.WithString("name", mcp.Description("Input parameter: The name of the repository.")), - mcp.WithBoolean("allow_forking", mcp.Description("Input parameter: Either `true` to allow private forks, or `false` to prevent private forks.")), - mcp.WithBoolean("allow_rebase_merge", mcp.Description("Input parameter: Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.")), - mcp.WithBoolean("archived", mcp.Description("Input parameter: Whether to archive this repository. `false` will unarchive a previously archived repository.")), - mcp.WithString("squash_merge_commit_title", mcp.Description("Input parameter: Required when using `squash_merge_commit_message`.\n\nThe default value for a squash merge commit title:\n\n- `PR_TITLE` - default to the pull request's title.\n- `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).")), + mcp.WithString("default_branch", mcp.Description("Input parameter: Updates the default branch for this repository.")), mcp.WithBoolean("allow_merge_commit", mcp.Description("Input parameter: Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.")), + mcp.WithBoolean("allow_update_branch", mcp.Description("Input parameter: Either `true` to always allow a pull request head branch that is behind its base branch to be updated even if it is not required to be up to date before merging, or false otherwise.")), mcp.WithBoolean("has_wiki", mcp.Description("Input parameter: Either `true` to enable the wiki for this repository or `false` to disable it.")), + mcp.WithString("merge_commit_message", mcp.Description("Input parameter: The default value for a merge commit message.\n\n- `PR_TITLE` - default to the pull request's title.\n- `PR_BODY` - default to the pull request's body.\n- `BLANK` - default to a blank commit message.")), mcp.WithString("squash_merge_commit_message", mcp.Description("Input parameter: The default value for a squash merge commit message:\n\n- `PR_BODY` - default to the pull request's body.\n- `COMMIT_MESSAGES` - default to the branch's commit messages.\n- `BLANK` - default to a blank commit message.")), - mcp.WithString("visibility", mcp.Description("Input parameter: The visibility of the repository.")), - mcp.WithBoolean("allow_squash_merge", mcp.Description("Input parameter: Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.")), - mcp.WithString("description", mcp.Description("Input parameter: A short description of the repository.")), + mcp.WithString("merge_commit_title", mcp.Description("Input parameter: Required when using `merge_commit_message`.\n\nThe default value for a merge commit title.\n\n- `PR_TITLE` - default to the pull request's title.\n- `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).")), mcp.WithObject("security_and_analysis", mcp.Description("Input parameter: Specify which security and analysis features to enable or disable for the repository.\n\nTo use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see \"[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).\"\n\nFor example, to enable GitHub Advanced Security, use this data in the body of the `PATCH` request:\n`{ \"security_and_analysis\": {\"advanced_security\": { \"status\": \"enabled\" } } }`.\n\nYou can check which security and analysis features are currently enabled by using a `GET /repos/{owner}/{repo}` request.")), - mcp.WithBoolean("allow_update_branch", mcp.Description("Input parameter: Either `true` to always allow a pull request head branch that is behind its base branch to be updated even if it is not required to be up to date before merging, or false otherwise.")), - mcp.WithString("homepage", mcp.Description("Input parameter: A URL with more information about the repository.")), - mcp.WithString("default_branch", mcp.Description("Input parameter: Updates the default branch for this repository.")), + mcp.WithBoolean("web_commit_signoff_required", mcp.Description("Input parameter: Either `true` to require contributors to sign off on web-based commits, or `false` to not require contributors to sign off on web-based commits.")), + mcp.WithBoolean("archived", mcp.Description("Input parameter: Whether to archive this repository. `false` will unarchive a previously archived repository.")), mcp.WithBoolean("delete_branch_on_merge", mcp.Description("Input parameter: Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion.")), - mcp.WithString("merge_commit_message", mcp.Description("Input parameter: The default value for a merge commit message.\n\n- `PR_TITLE` - default to the pull request's title.\n- `PR_BODY` - default to the pull request's body.\n- `BLANK` - default to a blank commit message.")), + mcp.WithString("squash_merge_commit_title", mcp.Description("Input parameter: Required when using `squash_merge_commit_message`.\n\nThe default value for a squash merge commit title:\n\n- `PR_TITLE` - default to the pull request's title.\n- `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).")), + mcp.WithBoolean("is_template", mcp.Description("Input parameter: Either `true` to make this repo available as a template repository or `false` to prevent it.")), + mcp.WithBoolean("allow_auto_merge", mcp.Description("Input parameter: Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.")), + mcp.WithString("name", mcp.Description("Input parameter: The name of the repository.")), + mcp.WithBoolean("allow_forking", mcp.Description("Input parameter: Either `true` to allow private forks, or `false` to prevent private forks.")), + mcp.WithBoolean("allow_rebase_merge", mcp.Description("Input parameter: Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.")), mcp.WithBoolean("has_issues", mcp.Description("Input parameter: Either `true` to enable issues for this repository or `false` to disable them.")), - mcp.WithString("merge_commit_title", mcp.Description("Input parameter: Required when using `merge_commit_message`.\n\nThe default value for a merge commit title.\n\n- `PR_TITLE` - default to the pull request's title.\n- `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).")), + mcp.WithBoolean("has_projects", mcp.Description("Input parameter: Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.")), + mcp.WithString("visibility", mcp.Description("Input parameter: The visibility of the repository.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_branch_protection.go b/MCP/go/tools/repos/repos_update_branch_protection.go index 9b7a314..267a86c 100644 --- a/MCP/go/tools/repos/repos_update_branch_protection.go +++ b/MCP/go/tools/repos/repos_update_branch_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_branch_protectionHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_branch_protectionHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_branch_protectionHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,17 +117,17 @@ func CreateRepos_update_branch_protectionTool(cfg *config.APIConfig) models.Tool mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("branch", mcp.Required(), mcp.Description("The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use [the GraphQL API](https://docs.github.com/graphql).")), - mcp.WithBoolean("enforce_admins", mcp.Required(), mcp.Description("Input parameter: Enforce all configured restrictions for administrators. Set to `true` to enforce required status checks for repository administrators. Set to `null` to disable.")), - mcp.WithBoolean("required_linear_history", mcp.Description("Input parameter: Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to `true` to enforce a linear commit history. Set to `false` to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: `false`. For more information, see \"[Requiring a linear commit history](https://docs.github.com/github/administering-a-repository/requiring-a-linear-commit-history)\" in the GitHub Help documentation.")), - mcp.WithBoolean("allow_force_pushes", mcp.Description("Input parameter: Permits force pushes to the protected branch by anyone with write access to the repository. Set to `true` to allow force pushes. Set to `false` or `null` to block force pushes. Default: `false`. For more information, see \"[Enabling force pushes to a protected branch](https://docs.github.com/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)\" in the GitHub Help documentation.\"")), - mcp.WithBoolean("lock_branch", mcp.Description("Input parameter: Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. Default: `false`.")), mcp.WithBoolean("allow_deletions", mcp.Description("Input parameter: Allows deletion of the protected branch by anyone with write access to the repository. Set to `false` to prevent deletion of the protected branch. Default: `false`. For more information, see \"[Enabling force pushes to a protected branch](https://docs.github.com/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)\" in the GitHub Help documentation.")), mcp.WithBoolean("block_creations", mcp.Description("Input parameter: If set to `true`, the `restrictions` branch protection settings which limits who can push will also block pushes which create new branches, unless the push is initiated by a user, team, or app which has the ability to push. Set to `true` to restrict new branch creation. Default: `false`.")), + mcp.WithBoolean("lock_branch", mcp.Description("Input parameter: Whether to set the branch as read-only. If this is true, users will not be able to push to the branch. Default: `false`.")), mcp.WithBoolean("required_conversation_resolution", mcp.Description("Input parameter: Requires all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule. Set to `false` to disable. Default: `false`.")), + mcp.WithBoolean("required_linear_history", mcp.Description("Input parameter: Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to `true` to enforce a linear commit history. Set to `false` to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: `false`. For more information, see \"[Requiring a linear commit history](https://docs.github.com/github/administering-a-repository/requiring-a-linear-commit-history)\" in the GitHub Help documentation.")), + mcp.WithBoolean("enforce_admins", mcp.Required(), mcp.Description("Input parameter: Enforce all configured restrictions for administrators. Set to `true` to enforce required status checks for repository administrators. Set to `null` to disable.")), mcp.WithObject("required_pull_request_reviews", mcp.Required(), mcp.Description("Input parameter: Require at least one approving review on a pull request, before merging. Set to `null` to disable.")), mcp.WithObject("required_status_checks", mcp.Required(), mcp.Description("Input parameter: Require status checks to pass before merging. Set to `null` to disable.")), - mcp.WithObject("restrictions", mcp.Required(), mcp.Description("Input parameter: Restrict who can push to the protected branch. User, app, and team `restrictions` are only available for organization-owned repositories. Set to `null` to disable.")), + mcp.WithBoolean("allow_force_pushes", mcp.Description("Input parameter: Permits force pushes to the protected branch by anyone with write access to the repository. Set to `true` to allow force pushes. Set to `false` or `null` to block force pushes. Default: `false`. For more information, see \"[Enabling force pushes to a protected branch](https://docs.github.com/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)\" in the GitHub Help documentation.\"")), mcp.WithBoolean("allow_fork_syncing", mcp.Description("Input parameter: Whether users can pull changes from upstream when the branch is locked. Set to `true` to allow fork syncing. Set to `false` to prevent fork syncing. Default: `false`.")), + mcp.WithObject("restrictions", mcp.Required(), mcp.Description("Input parameter: Restrict who can push to the protected branch. User, app, and team `restrictions` are only available for organization-owned repositories. Set to `null` to disable.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_commit_comment.go b/MCP/go/tools/repos/repos_update_commit_comment.go index 83e60c4..ae95aaf 100644 --- a/MCP/go/tools/repos/repos_update_commit_comment.go +++ b/MCP/go/tools/repos/repos_update_commit_comment.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_commit_commentHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_commit_commentHandler(cfg *config.APIConfig) func(ctx context. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/comments/%s%s", cfg.BaseURL, owner, repo, comment_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/comments/%s", cfg.BaseURL, owner, repo, comment_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_commit_commentHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Commit_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_update_deployment_branch_policy.go b/MCP/go/tools/repos/repos_update_deployment_branch_policy.go index 39e210b..919cdf0 100644 --- a/MCP/go/tools/repos/repos_update_deployment_branch_policy.go +++ b/MCP/go/tools/repos/repos_update_deployment_branch_policy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,41 +51,8 @@ func Repos_update_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct if !ok { return mcp.NewToolResultError("Invalid path parameter: branch_policy_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Deployment_branch_policy_name_pattern // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -101,23 +67,26 @@ func Repos_update_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies/%s%s", cfg.BaseURL, owner, repo, environment_name, branch_policy_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/environments/%s/deployment-branch-policies/%s", cfg.BaseURL, owner, repo, environment_name, branch_policy_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Repos_update_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Deployment_branch_policy if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -151,7 +120,7 @@ func Repos_update_deployment_branch_policyHandler(cfg *config.APIConfig) func(ct } func CreateRepos_update_deployment_branch_policyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_repos_owner_repo_environments_environment_name_deployment-branch-policies_branch_policy_id", + tool := mcp.NewTool("put_repos_owner_repo_environments_environment_name", mcp.WithDescription("Update a deployment branch policy"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_update_information_about_pages_site.go b/MCP/go/tools/repos/repos_update_information_about_pages_site.go index 6e884ff..70ef654 100644 --- a/MCP/go/tools/repos/repos_update_information_about_pages_site.go +++ b/MCP/go/tools/repos/repos_update_information_about_pages_site.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_update_information_about_pages_siteHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -85,23 +51,26 @@ func Repos_update_information_about_pages_siteHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/pages%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/pages", cfg.BaseURL, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,10 +108,10 @@ func CreateRepos_update_information_about_pages_siteTool(cfg *config.APIConfig) mcp.WithDescription("Update information about a GitHub Pages site"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithBoolean("https_enforced", mcp.Description("Input parameter: Specify whether HTTPS should be enforced for the repository.")), mcp.WithObject("source", mcp.Description("")), mcp.WithString("build_type", mcp.Description("Input parameter: The process by which the GitHub Pages site will be built. `workflow` means that the site is built by a custom GitHub Actions workflow. `legacy` means that the site is built by GitHub when changes are pushed to a specific branch.")), mcp.WithString("cname", mcp.Description("Input parameter: Specify a custom domain for the repository. Sending a `null` value will remove the custom domain. For more about custom domains, see \"[Using a custom domain with GitHub Pages](https://docs.github.com/pages/configuring-a-custom-domain-for-your-github-pages-site).\"")), + mcp.WithBoolean("https_enforced", mcp.Description("Input parameter: Specify whether HTTPS should be enforced for the repository.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_invitation.go b/MCP/go/tools/repos/repos_update_invitation.go index cd68f55..9a46a95 100644 --- a/MCP/go/tools/repos/repos_update_invitation.go +++ b/MCP/go/tools/repos/repos_update_invitation.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_invitationHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: invitation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_invitationHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/invitations/%s%s", cfg.BaseURL, owner, repo, invitation_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/invitations/%s", cfg.BaseURL, owner, repo, invitation_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_invitationHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_update_org_ruleset.go b/MCP/go/tools/repos/repos_update_org_ruleset.go index 463f1e3..608268d 100644 --- a/MCP/go/tools/repos/repos_update_org_ruleset.go +++ b/MCP/go/tools/repos/repos_update_org_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Repos_update_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: ruleset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Repos_update_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/rulesets/%s%s", cfg.BaseURL, org, ruleset_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/rulesets/%s", cfg.BaseURL, org, ruleset_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Repos_update_org_rulesetHandler(cfg *config.APIConfig) func(ctx context.Con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/repos/repos_update_pull_request_review_protection.go b/MCP/go/tools/repos/repos_update_pull_request_review_protection.go index 08b8846..2f6e07d 100644 --- a/MCP/go/tools/repos/repos_update_pull_request_review_protection.go +++ b/MCP/go/tools/repos/repos_update_pull_request_review_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_pull_request_review_protectionHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_pull_request_review_protectionHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_pull_request_reviews%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_pull_request_reviews", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_pull_request_review_protectionHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Protected_branch_pull_request_review if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,17 +112,17 @@ func Repos_update_pull_request_review_protectionHandler(cfg *config.APIConfig) f } func CreateRepos_update_pull_request_review_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_repos_owner_repo_branches_branch_protection_required_pull_request_reviews", + tool := mcp.NewTool("patch_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Update pull request review protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("branch", mcp.Required(), mcp.Description("The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use [the GraphQL API](https://docs.github.com/graphql).")), + mcp.WithObject("bypass_pull_request_allowances", mcp.Description("Input parameter: Allow specific users, teams, or apps to bypass pull request requirements.")), + mcp.WithBoolean("dismiss_stale_reviews", mcp.Description("Input parameter: Set to `true` if you want to automatically dismiss approving reviews when someone pushes a new commit.")), mcp.WithObject("dismissal_restrictions", mcp.Description("Input parameter: Specify which users, teams, and apps can dismiss pull request reviews. Pass an empty `dismissal_restrictions` object to disable. User and team `dismissal_restrictions` are only available for organization-owned repositories. Omit this parameter for personal repositories.")), mcp.WithBoolean("require_code_owner_reviews", mcp.Description("Input parameter: Blocks merging pull requests until [code owners](https://docs.github.com/articles/about-code-owners/) have reviewed.")), mcp.WithBoolean("require_last_push_approval", mcp.Description("Input parameter: Whether the most recent push must be approved by someone other than the person who pushed it. Default: `false`")), mcp.WithNumber("required_approving_review_count", mcp.Description("Input parameter: Specifies the number of reviewers required to approve pull requests. Use a number between 1 and 6 or 0 to not require reviewers.")), - mcp.WithObject("bypass_pull_request_allowances", mcp.Description("Input parameter: Allow specific users, teams, or apps to bypass pull request requirements.")), - mcp.WithBoolean("dismiss_stale_reviews", mcp.Description("Input parameter: Set to `true` if you want to automatically dismiss approving reviews when someone pushes a new commit.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_release.go b/MCP/go/tools/repos/repos_update_release.go index 0d94cb9..806c344 100644 --- a/MCP/go/tools/repos/repos_update_release.go +++ b/MCP/go/tools/repos/repos_update_release.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_releaseHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: release_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_releaseHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/releases/%s%s", cfg.BaseURL, owner, repo, release_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/%s", cfg.BaseURL, owner, repo, release_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -148,14 +117,14 @@ func CreateRepos_update_releaseTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("release_id", mcp.Required(), mcp.Description("The unique identifier of the release.")), - mcp.WithString("discussion_category_name", mcp.Description("Input parameter: If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored. For more information, see \"[Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository).\"")), - mcp.WithBoolean("draft", mcp.Description("Input parameter: `true` makes the release a draft, and `false` publishes the release.")), mcp.WithString("make_latest", mcp.Description("Input parameter: Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to `true` for newly published releases. `legacy` specifies that the latest release should be determined based on the release creation date and higher semantic version.")), mcp.WithString("name", mcp.Description("Input parameter: The name of the release.")), mcp.WithBoolean("prerelease", mcp.Description("Input parameter: `true` to identify the release as a prerelease, `false` to identify the release as a full release.")), mcp.WithString("tag_name", mcp.Description("Input parameter: The name of the tag.")), mcp.WithString("target_commitish", mcp.Description("Input parameter: Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch.")), mcp.WithString("body", mcp.Description("Input parameter: Text describing the contents of the tag.")), + mcp.WithString("discussion_category_name", mcp.Description("Input parameter: If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. If there is already a discussion linked to the release, this parameter is ignored. For more information, see \"[Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository).\"")), + mcp.WithBoolean("draft", mcp.Description("Input parameter: `true` makes the release a draft, and `false` publishes the release.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_release_asset.go b/MCP/go/tools/repos/repos_update_release_asset.go index 6daada6..521bf02 100644 --- a/MCP/go/tools/repos/repos_update_release_asset.go +++ b/MCP/go/tools/repos/repos_update_release_asset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_release_assetHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: asset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_release_assetHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/releases/assets/%s%s", cfg.BaseURL, owner, repo, asset_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/releases/assets/%s", cfg.BaseURL, owner, repo, asset_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_release_assetHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Release_asset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,9 +117,9 @@ func CreateRepos_update_release_assetTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("asset_id", mcp.Required(), mcp.Description("The unique identifier of the asset.")), + mcp.WithString("label", mcp.Description("Input parameter: An alternate short description of the asset. Used in place of the filename.")), mcp.WithString("name", mcp.Description("Input parameter: The file name of the asset.")), mcp.WithString("state", mcp.Description("")), - mcp.WithString("label", mcp.Description("Input parameter: An alternate short description of the asset. Used in place of the filename.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_repo_ruleset.go b/MCP/go/tools/repos/repos_update_repo_ruleset.go index f5c5fba..90ce4ed 100644 --- a/MCP/go/tools/repos/repos_update_repo_ruleset.go +++ b/MCP/go/tools/repos/repos_update_repo_ruleset.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co if !ok { return mcp.NewToolResultError("Invalid path parameter: ruleset_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/rulesets/%s%s", cfg.BaseURL, owner, repo, ruleset_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/rulesets/%s", cfg.BaseURL, owner, repo, ruleset_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_repo_rulesetHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_ruleset if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,12 +117,12 @@ func CreateRepos_update_repo_rulesetTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("ruleset_id", mcp.Required(), mcp.Description("The ID of the ruleset.")), - mcp.WithArray("bypass_actors", mcp.Description("Input parameter: The actors that can bypass the rules in this ruleset")), mcp.WithObject("conditions", mcp.Description("Input parameter: Parameters for a repository ruleset ref name condition")), mcp.WithString("enforcement", mcp.Description("Input parameter: The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).")), mcp.WithString("name", mcp.Description("Input parameter: The name of the ruleset.")), mcp.WithArray("rules", mcp.Description("Input parameter: An array of rules within the ruleset.")), mcp.WithString("target", mcp.Description("Input parameter: The target of the ruleset")), + mcp.WithArray("bypass_actors", mcp.Description("Input parameter: The actors that can bypass the rules in this ruleset")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_status_check_protection.go b/MCP/go/tools/repos/repos_update_status_check_protection.go index 203939b..171d95a 100644 --- a/MCP/go/tools/repos/repos_update_status_check_protection.go +++ b/MCP/go/tools/repos/repos_update_status_check_protection.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_status_check_protectionHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: branch"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_status_check_protectionHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks%s", cfg.BaseURL, owner, repo, branch, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/branches/%s/protection/required_status_checks", cfg.BaseURL, owner, repo, branch) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_status_check_protectionHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Status_check_policy if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Repos_update_status_check_protectionHandler(cfg *config.APIConfig) func(ctx } func CreateRepos_update_status_check_protectionTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_repos_owner_repo_branches_branch_protection_required_status_checks", + tool := mcp.NewTool("patch_repos_owner_repo_branches_branch_protection_required", mcp.WithDescription("Update status check protection"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/repos/repos_update_webhook.go b/MCP/go/tools/repos/repos_update_webhook.go index 1a95b9b..66cd1f5 100644 --- a/MCP/go/tools/repos/repos_update_webhook.go +++ b/MCP/go/tools/repos/repos_update_webhook.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_webhookHandler(cfg *config.APIConfig) func(ctx context.Context if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_webhookHandler(cfg *config.APIConfig) func(ctx context.Context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -148,11 +117,11 @@ func CreateRepos_update_webhookTool(cfg *config.APIConfig) models.Tool { mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("hook_id", mcp.Required(), mcp.Description("The unique identifier of the hook. You can find this value in the `X-GitHub-Hook-ID` header of a webhook delivery.")), - mcp.WithArray("events", mcp.Description("Input parameter: Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events.")), - mcp.WithArray("remove_events", mcp.Description("Input parameter: Determines a list of events to be removed from the list of events that the Hook triggers for.")), mcp.WithBoolean("active", mcp.Description("Input parameter: Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications.")), mcp.WithArray("add_events", mcp.Description("Input parameter: Determines a list of events to be added to the list of events that the Hook triggers for.")), mcp.WithObject("config", mcp.Description("Input parameter: Configuration object of the webhook")), + mcp.WithArray("events", mcp.Description("Input parameter: Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events.")), + mcp.WithArray("remove_events", mcp.Description("Input parameter: Determines a list of events to be removed from the list of events that the Hook triggers for.")), ) return models.Tool{ diff --git a/MCP/go/tools/repos/repos_update_webhook_config_for_repo.go b/MCP/go/tools/repos/repos_update_webhook_config_for_repo.go index 737d98a..f93928a 100644 --- a/MCP/go/tools/repos/repos_update_webhook_config_for_repo.go +++ b/MCP/go/tools/repos/repos_update_webhook_config_for_repo.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Repos_update_webhook_config_for_repoHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: hook_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Repos_update_webhook_config_for_repoHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/config%s", cfg.BaseURL, owner, repo, hook_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/hooks/%s/config", cfg.BaseURL, owner, repo, hook_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Repos_update_webhook_config_for_repoHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Webhook_config if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,10 +117,10 @@ func CreateRepos_update_webhook_config_for_repoTool(cfg *config.APIConfig) model mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithNumber("hook_id", mcp.Required(), mcp.Description("The unique identifier of the hook. You can find this value in the `X-GitHub-Hook-ID` header of a webhook delivery.")), - mcp.WithString("secret", mcp.Description("Input parameter: If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers).")), - mcp.WithString("url", mcp.Description("Input parameter: The URL to which the payloads will be delivered.")), mcp.WithString("content_type", mcp.Description("Input parameter: The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`.")), mcp.WithString("insecure_ssl", mcp.Description("")), + mcp.WithString("secret", mcp.Description("Input parameter: If provided, the `secret` will be used as the `key` to generate the HMAC hex digest value for [delivery signature headers](https://docs.github.com/webhooks/event-payloads/#delivery-headers).")), + mcp.WithString("url", mcp.Description("Input parameter: The URL to which the payloads will be delivered.")), ) return models.Tool{ diff --git a/MCP/go/tools/search/search_code.go b/MCP/go/tools/search/search_code.go index 2723184..0ccc5b1 100644 --- a/MCP/go/tools/search/search_code.go +++ b/MCP/go/tools/search/search_code.go @@ -35,34 +35,6 @@ func Search_codeHandler(cfg *config.APIConfig) func(ctx context.Context, request if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -72,17 +44,20 @@ func Search_codeHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/search/search_commits.go b/MCP/go/tools/search/search_commits.go index 434af4e..d57ca3f 100644 --- a/MCP/go/tools/search/search_commits.go +++ b/MCP/go/tools/search/search_commits.go @@ -35,34 +35,6 @@ func Search_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, requ if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -72,17 +44,20 @@ func Search_commitsHandler(cfg *config.APIConfig) func(ctx context.Context, requ if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/search/search_issues_and_pull_requests.go b/MCP/go/tools/search/search_issues_and_pull_requests.go index dcbb024..23d9285 100644 --- a/MCP/go/tools/search/search_issues_and_pull_requests.go +++ b/MCP/go/tools/search/search_issues_and_pull_requests.go @@ -38,34 +38,6 @@ func Search_issues_and_pull_requestsHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["advanced_search"]; ok { queryParams = append(queryParams, fmt.Sprintf("advanced_search=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -75,17 +47,20 @@ func Search_issues_and_pull_requestsHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/search/search_labels.go b/MCP/go/tools/search/search_labels.go index be8ca91..c4b69d5 100644 --- a/MCP/go/tools/search/search_labels.go +++ b/MCP/go/tools/search/search_labels.go @@ -38,34 +38,6 @@ func Search_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, reque if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -75,17 +47,20 @@ func Search_labelsHandler(cfg *config.APIConfig) func(ctx context.Context, reque if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/search/search_repos.go b/MCP/go/tools/search/search_repos.go index fe4be87..5144ddf 100644 --- a/MCP/go/tools/search/search_repos.go +++ b/MCP/go/tools/search/search_repos.go @@ -35,34 +35,6 @@ func Search_reposHandler(cfg *config.APIConfig) func(ctx context.Context, reques if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -72,17 +44,20 @@ func Search_reposHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/search/search_topics.go b/MCP/go/tools/search/search_topics.go index 9f35e8e..31389ca 100644 --- a/MCP/go/tools/search/search_topics.go +++ b/MCP/go/tools/search/search_topics.go @@ -29,34 +29,6 @@ func Search_topicsHandler(cfg *config.APIConfig) func(ctx context.Context, reque if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -66,17 +38,20 @@ func Search_topicsHandler(cfg *config.APIConfig) func(ctx context.Context, reque if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/search/search_users.go b/MCP/go/tools/search/search_users.go index 99d7a0e..9bcf279 100644 --- a/MCP/go/tools/search/search_users.go +++ b/MCP/go/tools/search/search_users.go @@ -35,34 +35,6 @@ func Search_usersHandler(cfg *config.APIConfig) func(ctx context.Context, reques if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -72,17 +44,20 @@ func Search_usersHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/secret_scanning/secret_scanning_create_push_protection_bypass.go b/MCP/go/tools/secret_scanning/secret_scanning_create_push_protection_bypass.go index 5d65825..8469e0f 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_create_push_protection_bypass.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_create_push_protection_bypass.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Secret_scanning_create_push_protection_bypassHandler(cfg *config.APIConfig) if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Secret_scanning_create_push_protection_bypassHandler(cfg *config.APIConfig) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/secret-scanning/push-protection-bypasses%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/secret-scanning/push-protection-bypasses", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Secret_scanning_create_push_protection_bypassHandler(cfg *config.APIConfig) return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Secret_scanning_push_protection_bypass if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -135,7 +104,7 @@ func Secret_scanning_create_push_protection_bypassHandler(cfg *config.APIConfig) } func CreateSecret_scanning_create_push_protection_bypassTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_repos_owner_repo_secret-scanning_push-protection-bypasses", + tool := mcp.NewTool("post_repos_owner_repo_secret-scanning", mcp.WithDescription("Create a push protection bypass"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/secret_scanning/secret_scanning_get_alert.go b/MCP/go/tools/secret_scanning/secret_scanning_get_alert.go index 85f0000..bdc1381 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_get_alert.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_get_alert.go @@ -47,34 +47,6 @@ func Secret_scanning_get_alertHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["hide_secret"]; ok { queryParams = append(queryParams, fmt.Sprintf("hide_secret=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -84,17 +56,20 @@ func Secret_scanning_get_alertHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -112,7 +87,7 @@ func Secret_scanning_get_alertHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Secret_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -128,7 +103,7 @@ func Secret_scanning_get_alertHandler(cfg *config.APIConfig) func(ctx context.Co } func CreateSecret_scanning_get_alertTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_secret-scanning_alerts_alert_number", + tool := mcp.NewTool("get_repos_owner_repo_secret-scanning_alerts_alert_number_2", mcp.WithDescription("Get a secret scanning alert"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/secret_scanning/secret_scanning_get_scan_history.go b/MCP/go/tools/secret_scanning/secret_scanning_get_scan_history.go index 734fe62..1e1f775 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_get_scan_history.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_get_scan_history.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Secret_scanning_get_scan_historyHandler(cfg *config.APIConfig) func(ctx con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/secret-scanning/scan-history%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/secret-scanning/scan-history", cfg.BaseURL, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Secret_scanning_get_scan_historyHandler(cfg *config.APIConfig) func(ctx con return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Secret_scanning_scan_history if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_enterprise.go b/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_enterprise.go index fd4e1d7..a50e06c 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_enterprise.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_enterprise.go @@ -64,34 +64,6 @@ func Secret_scanning_list_alerts_for_enterpriseHandler(cfg *config.APIConfig) fu if val, ok := args["hide_secret"]; ok { queryParams = append(queryParams, fmt.Sprintf("hide_secret=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -101,17 +73,20 @@ func Secret_scanning_list_alerts_for_enterpriseHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -129,7 +104,7 @@ func Secret_scanning_list_alerts_for_enterpriseHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_secret_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_org.go b/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_org.go index 10c8e18..35892b0 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_org.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_org.go @@ -67,34 +67,6 @@ func Secret_scanning_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx if val, ok := args["hide_secret"]; ok { queryParams = append(queryParams, fmt.Sprintf("hide_secret=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -104,17 +76,20 @@ func Secret_scanning_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -132,7 +107,7 @@ func Secret_scanning_list_alerts_for_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_secret_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_repo.go b/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_repo.go index 02b2dfb..2dc65fa 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_repo.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_list_alerts_for_repo.go @@ -75,34 +75,6 @@ func Secret_scanning_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx if val, ok := args["hide_secret"]; ok { queryParams = append(queryParams, fmt.Sprintf("hide_secret=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -112,17 +84,20 @@ func Secret_scanning_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -140,7 +115,7 @@ func Secret_scanning_list_alerts_for_repoHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Secret_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/secret_scanning/secret_scanning_list_locations_for_alert.go b/MCP/go/tools/secret_scanning/secret_scanning_list_locations_for_alert.go index 8ce1203..9cf3204 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_list_locations_for_alert.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_list_locations_for_alert.go @@ -50,34 +50,6 @@ func Secret_scanning_list_locations_for_alertHandler(cfg *config.APIConfig) func if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -87,17 +59,20 @@ func Secret_scanning_list_locations_for_alertHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -115,7 +90,7 @@ func Secret_scanning_list_locations_for_alertHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Secret_scanning_location if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -131,7 +106,7 @@ func Secret_scanning_list_locations_for_alertHandler(cfg *config.APIConfig) func } func CreateSecret_scanning_list_locations_for_alertTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_repos_owner_repo_secret-scanning_alerts_alert_number_locations", + tool := mcp.NewTool("get_repos_owner_repo_secret-scanning_alerts_alert_number", mcp.WithDescription("List locations for a secret scanning alert"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), diff --git a/MCP/go/tools/secret_scanning/secret_scanning_update_alert.go b/MCP/go/tools/secret_scanning/secret_scanning_update_alert.go index d7cf795..bf5072e 100644 --- a/MCP/go/tools/secret_scanning/secret_scanning_update_alert.go +++ b/MCP/go/tools/secret_scanning/secret_scanning_update_alert.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Secret_scanning_update_alertHandler(cfg *config.APIConfig) func(ctx context if !ok { return mcp.NewToolResultError("Invalid path parameter: alert_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Secret_scanning_update_alertHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/secret-scanning/alerts/%s%s", cfg.BaseURL, owner, repo, alert_number, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/secret-scanning/alerts/%s", cfg.BaseURL, owner, repo, alert_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Secret_scanning_update_alertHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Secret_scanning_alert if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/security_advisories/security_advisories_create_fork.go b/MCP/go/tools/security_advisories/security_advisories_create_fork.go index c2ff77b..044077a 100644 --- a/MCP/go/tools/security_advisories/security_advisories_create_fork.go +++ b/MCP/go/tools/security_advisories/security_advisories_create_fork.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Security_advisories_create_forkHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: ghsa_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s/forks%s", cfg.BaseURL, owner, repo, ghsa_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s/forks", cfg.BaseURL, owner, repo, ghsa_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/security_advisories/security_advisories_create_private_vulnerability_report.go b/MCP/go/tools/security_advisories/security_advisories_create_private_vulnerability_report.go index ac02ae3..0597e02 100644 --- a/MCP/go/tools/security_advisories/security_advisories_create_private_vulnerability_report.go +++ b/MCP/go/tools/security_advisories/security_advisories_create_private_vulnerability_report.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Security_advisories_create_private_vulnerability_reportHandler(cfg *config. if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Private_vulnerability_report_create // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Security_advisories_create_private_vulnerability_reportHandler(cfg *config. if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/reports%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/reports", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Security_advisories_create_private_vulnerability_reportHandler(cfg *config. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,13 +108,13 @@ func CreateSecurity_advisories_create_private_vulnerability_reportTool(cfg *conf mcp.WithDescription("Privately report a security vulnerability"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithArray("cwe_ids", mcp.Description("Input parameter: A list of Common Weakness Enumeration (CWE) IDs.")), - mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A detailed description of what the advisory impacts.")), mcp.WithString("severity", mcp.Description("Input parameter: The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.")), mcp.WithBoolean("start_private_fork", mcp.Description("Input parameter: Whether to create a temporary private fork of the repository to collaborate on a fix.")), mcp.WithString("summary", mcp.Required(), mcp.Description("Input parameter: A short summary of the advisory.")), mcp.WithArray("vulnerabilities", mcp.Description("Input parameter: An array of products affected by the vulnerability detailed in a repository security advisory.")), mcp.WithString("cvss_vector_string", mcp.Description("Input parameter: The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`.")), + mcp.WithArray("cwe_ids", mcp.Description("Input parameter: A list of Common Weakness Enumeration (CWE) IDs.")), + mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A detailed description of what the advisory impacts.")), ) return models.Tool{ diff --git a/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory.go b/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory.go index ea2f99f..ede0355 100644 --- a/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory.go +++ b/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,41 +35,8 @@ func Security_advisories_create_repository_advisoryHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Repository_advisory_create // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -85,23 +51,26 @@ func Security_advisories_create_repository_advisoryHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/security-advisories%s", cfg.BaseURL, owner, repo, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/security-advisories", cfg.BaseURL, owner, repo) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Security_advisories_create_repository_advisoryHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,15 +108,15 @@ func CreateSecurity_advisories_create_repository_advisoryTool(cfg *config.APICon mcp.WithDescription("Create a repository security advisory"), mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), - mcp.WithArray("cwe_ids", mcp.Description("Input parameter: A list of Common Weakness Enumeration (CWE) IDs.")), - mcp.WithString("severity", mcp.Description("Input parameter: The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.")), - mcp.WithArray("credits", mcp.Description("Input parameter: A list of users receiving credit for their participation in the security advisory.")), mcp.WithString("cve_id", mcp.Description("Input parameter: The Common Vulnerabilities and Exposures (CVE) ID.")), - mcp.WithString("summary", mcp.Required(), mcp.Description("Input parameter: A short summary of the advisory.")), mcp.WithString("description", mcp.Required(), mcp.Description("Input parameter: A detailed description of what the advisory impacts.")), + mcp.WithString("cvss_vector_string", mcp.Description("Input parameter: The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`.")), + mcp.WithArray("cwe_ids", mcp.Description("Input parameter: A list of Common Weakness Enumeration (CWE) IDs.")), + mcp.WithString("severity", mcp.Description("Input parameter: The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.")), mcp.WithBoolean("start_private_fork", mcp.Description("Input parameter: Whether to create a temporary private fork of the repository to collaborate on a fix.")), + mcp.WithString("summary", mcp.Required(), mcp.Description("Input parameter: A short summary of the advisory.")), mcp.WithArray("vulnerabilities", mcp.Required(), mcp.Description("Input parameter: A product affected by the vulnerability detailed in a repository security advisory.")), - mcp.WithString("cvss_vector_string", mcp.Description("Input parameter: The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`.")), + mcp.WithArray("credits", mcp.Description("Input parameter: A list of users receiving credit for their participation in the security advisory.")), ) return models.Tool{ diff --git a/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory_cve_request.go b/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory_cve_request.go index d39e466..3fa3079 100644 --- a/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory_cve_request.go +++ b/MCP/go/tools/security_advisories/security_advisories_create_repository_advisory_cve_request.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Security_advisories_create_repository_advisory_cve_requestHandler(cfg *conf if !ok { return mcp.NewToolResultError("Invalid path parameter: ghsa_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s/cve%s", cfg.BaseURL, owner, repo, ghsa_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s/cve", cfg.BaseURL, owner, repo, ghsa_id) req, err := http.NewRequest("POST", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/security_advisories/security_advisories_get_global_advisory.go b/MCP/go/tools/security_advisories/security_advisories_get_global_advisory.go index 38ae428..5f254b1 100644 --- a/MCP/go/tools/security_advisories/security_advisories_get_global_advisory.go +++ b/MCP/go/tools/security_advisories/security_advisories_get_global_advisory.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Security_advisories_get_global_advisoryHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: ghsa_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/advisories/%s%s", cfg.BaseURL, ghsa_id, queryString) + url := fmt.Sprintf("%s/advisories/%s", cfg.BaseURL, ghsa_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Security_advisories_get_global_advisoryHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Global_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/security_advisories/security_advisories_get_repository_advisory.go b/MCP/go/tools/security_advisories/security_advisories_get_repository_advisory.go index 2dce859..f63526a 100644 --- a/MCP/go/tools/security_advisories/security_advisories_get_repository_advisory.go +++ b/MCP/go/tools/security_advisories/security_advisories_get_repository_advisory.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Security_advisories_get_repository_advisoryHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: ghsa_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s%s", cfg.BaseURL, owner, repo, ghsa_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s", cfg.BaseURL, owner, repo, ghsa_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Security_advisories_get_repository_advisoryHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/security_advisories/security_advisories_list_global_advisories.go b/MCP/go/tools/security_advisories/security_advisories_list_global_advisories.go index 6b317c8..fd432f4 100644 --- a/MCP/go/tools/security_advisories/security_advisories_list_global_advisories.go +++ b/MCP/go/tools/security_advisories/security_advisories_list_global_advisories.go @@ -74,34 +74,6 @@ func Security_advisories_list_global_advisoriesHandler(cfg *config.APIConfig) fu if val, ok := args["sort"]; ok { queryParams = append(queryParams, fmt.Sprintf("sort=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -111,17 +83,20 @@ func Security_advisories_list_global_advisoriesHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -139,7 +114,7 @@ func Security_advisories_list_global_advisoriesHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Global_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/security_advisories/security_advisories_list_org_repository_advisories.go b/MCP/go/tools/security_advisories/security_advisories_list_org_repository_advisories.go index 889f026..4c7507f 100644 --- a/MCP/go/tools/security_advisories/security_advisories_list_org_repository_advisories.go +++ b/MCP/go/tools/security_advisories/security_advisories_list_org_repository_advisories.go @@ -46,34 +46,6 @@ func Security_advisories_list_org_repository_advisoriesHandler(cfg *config.APICo if val, ok := args["state"]; ok { queryParams = append(queryParams, fmt.Sprintf("state=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -83,17 +55,20 @@ func Security_advisories_list_org_repository_advisoriesHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +86,7 @@ func Security_advisories_list_org_repository_advisoriesHandler(cfg *config.APICo return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/security_advisories/security_advisories_list_repository_advisories.go b/MCP/go/tools/security_advisories/security_advisories_list_repository_advisories.go index 29d2bea..c936a35 100644 --- a/MCP/go/tools/security_advisories/security_advisories_list_repository_advisories.go +++ b/MCP/go/tools/security_advisories/security_advisories_list_repository_advisories.go @@ -54,34 +54,6 @@ func Security_advisories_list_repository_advisoriesHandler(cfg *config.APIConfig if val, ok := args["state"]; ok { queryParams = append(queryParams, fmt.Sprintf("state=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -91,17 +63,20 @@ func Security_advisories_list_repository_advisoriesHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +94,7 @@ func Security_advisories_list_repository_advisoriesHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Repository_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/security_advisories/security_advisories_update_repository_advisory.go b/MCP/go/tools/security_advisories/security_advisories_update_repository_advisory.go index 0a6fef9..2d1e3d3 100644 --- a/MCP/go/tools/security_advisories/security_advisories_update_repository_advisory.go +++ b/MCP/go/tools/security_advisories/security_advisories_update_repository_advisory.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,41 +43,8 @@ func Security_advisories_update_repository_advisoryHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: ghsa_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema - var requestBody models.GeneratedType + var requestBody models.GeneratedType_Repository_advisory_update // Optimized: Single marshal/unmarshal with JSON tags handling field mapping if argsJSON, err := json.Marshal(args); err == nil { @@ -93,23 +59,26 @@ func Security_advisories_update_repository_advisoryHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s%s", cfg.BaseURL, owner, repo, ghsa_id, queryString) + url := fmt.Sprintf("%s/repos/%s/%s/security-advisories/%s", cfg.BaseURL, owner, repo, ghsa_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Security_advisories_update_repository_advisoryHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Repository_advisory if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -148,17 +117,17 @@ func CreateSecurity_advisories_update_repository_advisoryTool(cfg *config.APICon mcp.WithString("owner", mcp.Required(), mcp.Description("The account owner of the repository. The name is not case sensitive.")), mcp.WithString("repo", mcp.Required(), mcp.Description("The name of the repository without the `.git` extension. The name is not case sensitive.")), mcp.WithString("ghsa_id", mcp.Required(), mcp.Description("The GHSA (GitHub Security Advisory) identifier of the advisory.")), - mcp.WithString("description", mcp.Description("Input parameter: A detailed description of what the advisory impacts.")), mcp.WithString("state", mcp.Description("Input parameter: The state of the advisory.")), - mcp.WithString("cvss_vector_string", mcp.Description("Input parameter: The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`.")), - mcp.WithArray("vulnerabilities", mcp.Description("Input parameter: A product affected by the vulnerability detailed in a repository security advisory.")), - mcp.WithString("cve_id", mcp.Description("Input parameter: The Common Vulnerabilities and Exposures (CVE) ID.")), - mcp.WithString("severity", mcp.Description("Input parameter: The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.")), mcp.WithArray("credits", mcp.Description("Input parameter: A list of users receiving credit for their participation in the security advisory.")), + mcp.WithArray("vulnerabilities", mcp.Description("Input parameter: A product affected by the vulnerability detailed in a repository security advisory.")), mcp.WithArray("cwe_ids", mcp.Description("Input parameter: A list of Common Weakness Enumeration (CWE) IDs.")), + mcp.WithArray("collaborating_users", mcp.Description("Input parameter: A list of usernames who have been granted write access to the advisory.")), + mcp.WithString("cvss_vector_string", mcp.Description("Input parameter: The CVSS vector that calculates the severity of the advisory. You must choose between setting this field or `severity`.")), + mcp.WithString("severity", mcp.Description("Input parameter: The severity of the advisory. You must choose between setting this field or `cvss_vector_string`.")), mcp.WithString("summary", mcp.Description("Input parameter: A short summary of the advisory.")), mcp.WithArray("collaborating_teams", mcp.Description("Input parameter: A list of team slugs which have been granted write access to the advisory.")), - mcp.WithArray("collaborating_users", mcp.Description("Input parameter: A list of usernames who have been granted write access to the advisory.")), + mcp.WithString("cve_id", mcp.Description("Input parameter: The Common Vulnerabilities and Exposures (CVE) ID.")), + mcp.WithString("description", mcp.Description("Input parameter: A detailed description of what the advisory impacts.")), ) return models.Tool{ diff --git a/MCP/go/tools/teams/teams_add_member_legacy.go b/MCP/go/tools/teams/teams_add_member_legacy.go index 9416d35..9deae5e 100644 --- a/MCP/go/tools/teams/teams_add_member_legacy.go +++ b/MCP/go/tools/teams/teams_add_member_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_add_member_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/members/%s%s", cfg.BaseURL, team_id, username, queryString) + url := fmt.Sprintf("%s/teams/%s/members/%s", cfg.BaseURL, team_id, username) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_add_or_update_membership_for_user_in_org.go b/MCP/go/tools/teams/teams_add_or_update_membership_for_user_in_org.go index 126e779..cbbe30d 100644 --- a/MCP/go/tools/teams/teams_add_or_update_membership_for_user_in_org.go +++ b/MCP/go/tools/teams/teams_add_or_update_membership_for_user_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Teams_add_or_update_membership_for_user_in_orgHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Teams_add_or_update_membership_for_user_in_orgHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/memberships/%s%s", cfg.BaseURL, org, team_slug, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/memberships/%s", cfg.BaseURL, org, team_slug, username) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Teams_add_or_update_membership_for_user_in_orgHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_add_or_update_membership_for_user_legacy.go b/MCP/go/tools/teams/teams_add_or_update_membership_for_user_legacy.go index 435b7b6..483ed85 100644 --- a/MCP/go/tools/teams/teams_add_or_update_membership_for_user_legacy.go +++ b/MCP/go/tools/teams/teams_add_or_update_membership_for_user_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Teams_add_or_update_membership_for_user_legacyHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Teams_add_or_update_membership_for_user_legacyHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/memberships/%s%s", cfg.BaseURL, team_id, username, queryString) + url := fmt.Sprintf("%s/teams/%s/memberships/%s", cfg.BaseURL, team_id, username) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Teams_add_or_update_membership_for_user_legacyHandler(cfg *config.APIConfig return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_add_or_update_project_permissions_in_org.go b/MCP/go/tools/teams/teams_add_or_update_project_permissions_in_org.go index a6888ff..cfe1978 100644 --- a/MCP/go/tools/teams/teams_add_or_update_project_permissions_in_org.go +++ b/MCP/go/tools/teams/teams_add_or_update_project_permissions_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Teams_add_or_update_project_permissions_in_orgHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Teams_add_or_update_project_permissions_in_orgHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/projects/%s%s", cfg.BaseURL, org, team_slug, project_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/projects/%s", cfg.BaseURL, org, team_slug, project_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_add_or_update_project_permissions_legacy.go b/MCP/go/tools/teams/teams_add_or_update_project_permissions_legacy.go index 530dbed..e56b461 100644 --- a/MCP/go/tools/teams/teams_add_or_update_project_permissions_legacy.go +++ b/MCP/go/tools/teams/teams_add_or_update_project_permissions_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Teams_add_or_update_project_permissions_legacyHandler(cfg *config.APIConfig if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Teams_add_or_update_project_permissions_legacyHandler(cfg *config.APIConfig if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/projects/%s%s", cfg.BaseURL, team_id, project_id, queryString) + url := fmt.Sprintf("%s/teams/%s/projects/%s", cfg.BaseURL, team_id, project_id) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Teams_add_or_update_project_permissions_legacyHandler(cfg *config.APIConfig } func CreateTeams_add_or_update_project_permissions_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("put_teams_team_id_projects_project_id", + tool := mcp.NewTool("put_teams_team_id_projects_project", mcp.WithDescription("Add or update team project permissions (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("project_id", mcp.Required(), mcp.Description("The unique identifier of the project.")), diff --git a/MCP/go/tools/teams/teams_add_or_update_repo_permissions_in_org.go b/MCP/go/tools/teams/teams_add_or_update_repo_permissions_in_org.go index 7a277da..f63f04b 100644 --- a/MCP/go/tools/teams/teams_add_or_update_repo_permissions_in_org.go +++ b/MCP/go/tools/teams/teams_add_or_update_repo_permissions_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Teams_add_or_update_repo_permissions_in_orgHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Teams_add_or_update_repo_permissions_in_orgHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/repos/%s/%s%s", cfg.BaseURL, org, team_slug, owner, repo, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/repos/%s/%s", cfg.BaseURL, org, team_slug, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_add_or_update_repo_permissions_legacy.go b/MCP/go/tools/teams/teams_add_or_update_repo_permissions_legacy.go index 509d5e7..c300b1d 100644 --- a/MCP/go/tools/teams/teams_add_or_update_repo_permissions_legacy.go +++ b/MCP/go/tools/teams/teams_add_or_update_repo_permissions_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Teams_add_or_update_repo_permissions_legacyHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Teams_add_or_update_repo_permissions_legacyHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/repos/%s/%s%s", cfg.BaseURL, team_id, owner, repo, queryString) + url := fmt.Sprintf("%s/teams/%s/repos/%s/%s", cfg.BaseURL, team_id, owner, repo) req, err := http.NewRequest("PUT", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_check_permissions_for_project_in_org.go b/MCP/go/tools/teams/teams_check_permissions_for_project_in_org.go index 2ac0929..aea4a8b 100644 --- a/MCP/go/tools/teams/teams_check_permissions_for_project_in_org.go +++ b/MCP/go/tools/teams/teams_check_permissions_for_project_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_check_permissions_for_project_in_orgHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/projects/%s%s", cfg.BaseURL, org, team_slug, project_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/projects/%s", cfg.BaseURL, org, team_slug, project_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Teams_check_permissions_for_project_in_orgHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_check_permissions_for_project_legacy.go b/MCP/go/tools/teams/teams_check_permissions_for_project_legacy.go index 5930307..4bfa117 100644 --- a/MCP/go/tools/teams/teams_check_permissions_for_project_legacy.go +++ b/MCP/go/tools/teams/teams_check_permissions_for_project_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_check_permissions_for_project_legacyHandler(cfg *config.APIConfig) fu if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/projects/%s%s", cfg.BaseURL, team_id, project_id, queryString) + url := fmt.Sprintf("%s/teams/%s/projects/%s", cfg.BaseURL, team_id, project_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Teams_check_permissions_for_project_legacyHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Teams_check_permissions_for_project_legacyHandler(cfg *config.APIConfig) fu } func CreateTeams_check_permissions_for_project_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_teams_team_id_projects_project_id", + tool := mcp.NewTool("get_teams_team_id_projects_project", mcp.WithDescription("Check team permissions for a project (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("project_id", mcp.Required(), mcp.Description("The unique identifier of the project.")), diff --git a/MCP/go/tools/teams/teams_check_permissions_for_repo_in_org.go b/MCP/go/tools/teams/teams_check_permissions_for_repo_in_org.go index 3cd18a4..92b7211 100644 --- a/MCP/go/tools/teams/teams_check_permissions_for_repo_in_org.go +++ b/MCP/go/tools/teams/teams_check_permissions_for_repo_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Teams_check_permissions_for_repo_in_orgHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/repos/%s/%s%s", cfg.BaseURL, org, team_slug, owner, repo, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/repos/%s/%s", cfg.BaseURL, org, team_slug, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Teams_check_permissions_for_repo_in_orgHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_check_permissions_for_repo_legacy.go b/MCP/go/tools/teams/teams_check_permissions_for_repo_legacy.go index 720e5da..44d32d6 100644 --- a/MCP/go/tools/teams/teams_check_permissions_for_repo_legacy.go +++ b/MCP/go/tools/teams/teams_check_permissions_for_repo_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_check_permissions_for_repo_legacyHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/repos/%s/%s%s", cfg.BaseURL, team_id, owner, repo, queryString) + url := fmt.Sprintf("%s/teams/%s/repos/%s/%s", cfg.BaseURL, team_id, owner, repo) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Teams_check_permissions_for_repo_legacyHandler(cfg *config.APIConfig) func( return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_create.go b/MCP/go/tools/teams/teams_create.go index dd817ec..738604e 100644 --- a/MCP/go/tools/teams/teams_create.go +++ b/MCP/go/tools/teams/teams_create.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Teams_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: org"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Teams_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams%s", cfg.BaseURL, org, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams", cfg.BaseURL, org) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Teams_createHandler(cfg *config.APIConfig) func(ctx context.Context, reques return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,7 +99,6 @@ func CreateTeams_createTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_orgs_org_teams", mcp.WithDescription("Create a team"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), - mcp.WithString("notification_setting", mcp.Description("Input parameter: The notification setting the team has chosen. The options are: \n * `notifications_enabled` - team members receive notifications when the team is @mentioned. \n * `notifications_disabled` - no one receives notifications. \nDefault: `notifications_enabled`")), mcp.WithNumber("parent_team_id", mcp.Description("Input parameter: The ID of a team to set as the parent team.")), mcp.WithString("permission", mcp.Description("Input parameter: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified.")), mcp.WithString("privacy", mcp.Description("Input parameter: The level of privacy this team should have. The options are: \n**For a non-nested team:** \n * `secret` - only visible to organization owners and members of this team. \n * `closed` - visible to all members of this organization. \nDefault: `secret` \n**For a parent or child team:** \n * `closed` - visible to all members of this organization. \nDefault for child team: `closed`")), @@ -138,6 +106,7 @@ func CreateTeams_createTool(cfg *config.APIConfig) models.Tool { mcp.WithString("description", mcp.Description("Input parameter: The description of the team.")), mcp.WithArray("maintainers", mcp.Description("Input parameter: List GitHub usernames for organization members who will become team maintainers.")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the team.")), + mcp.WithString("notification_setting", mcp.Description("Input parameter: The notification setting the team has chosen. The options are: \n * `notifications_enabled` - team members receive notifications when the team is @mentioned. \n * `notifications_disabled` - no one receives notifications. \nDefault: `notifications_enabled`")), ) return models.Tool{ diff --git a/MCP/go/tools/teams/teams_create_discussion_comment_in_org.go b/MCP/go/tools/teams/teams_create_discussion_comment_in_org.go index 28ebdf3..889dbd3 100644 --- a/MCP/go/tools/teams/teams_create_discussion_comment_in_org.go +++ b/MCP/go/tools/teams/teams_create_discussion_comment_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Teams_create_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Teams_create_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments%s", cfg.BaseURL, org, team_slug, discussion_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments", cfg.BaseURL, org, team_slug, discussion_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Teams_create_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Teams_create_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c } func CreateTeams_create_discussion_comment_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("post_orgs_org_teams_team_slug_discussions_discussion_number_comments", + tool := mcp.NewTool("post_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("Create a discussion comment"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_create_discussion_comment_legacy.go b/MCP/go/tools/teams/teams_create_discussion_comment_legacy.go index 1ba50bb..c79554f 100644 --- a/MCP/go/tools/teams/teams_create_discussion_comment_legacy.go +++ b/MCP/go/tools/teams/teams_create_discussion_comment_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Teams_create_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Teams_create_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments%s", cfg.BaseURL, team_id, discussion_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments", cfg.BaseURL, team_id, discussion_number) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Teams_create_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_create_discussion_in_org.go b/MCP/go/tools/teams/teams_create_discussion_in_org.go index 47a9763..03ef047 100644 --- a/MCP/go/tools/teams/teams_create_discussion_in_org.go +++ b/MCP/go/tools/teams/teams_create_discussion_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Teams_create_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Teams_create_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Teams_create_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_create_discussion_legacy.go b/MCP/go/tools/teams/teams_create_discussion_legacy.go index 4cd793e..651e11e 100644 --- a/MCP/go/tools/teams/teams_create_discussion_legacy.go +++ b/MCP/go/tools/teams/teams_create_discussion_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Teams_create_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: team_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Teams_create_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/discussions%s", cfg.BaseURL, team_id, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions", cfg.BaseURL, team_id) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Teams_create_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_delete_discussion_comment_in_org.go b/MCP/go/tools/teams/teams_delete_discussion_comment_in_org.go index 6a9e5a2..32a3512 100644 --- a/MCP/go/tools/teams/teams_delete_discussion_comment_in_org.go +++ b/MCP/go/tools/teams/teams_delete_discussion_comment_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Teams_delete_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -133,7 +102,7 @@ func Teams_delete_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c } func CreateTeams_delete_discussion_comment_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion_number_comments_comment_number", + tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion", mcp.WithDescription("Delete a discussion comment"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_delete_discussion_comment_legacy.go b/MCP/go/tools/teams/teams_delete_discussion_comment_legacy.go index 515671e..f0beee7 100644 --- a/MCP/go/tools/teams/teams_delete_discussion_comment_legacy.go +++ b/MCP/go/tools/teams/teams_delete_discussion_comment_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_delete_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s%s", cfg.BaseURL, team_id, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s", cfg.BaseURL, team_id, discussion_number, comment_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Teams_delete_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c } func CreateTeams_delete_discussion_comment_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_teams_team_id_discussions_discussion_number_comments_comment_number", + tool := mcp.NewTool("delete_teams_team_id_discussions_discussion_number_comments", mcp.WithDescription("Delete a discussion comment (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("discussion_number", mcp.Required(), mcp.Description("The number that identifies the discussion.")), diff --git a/MCP/go/tools/teams/teams_delete_discussion_in_org.go b/MCP/go/tools/teams/teams_delete_discussion_in_org.go index abc2b95..457deda 100644 --- a/MCP/go/tools/teams/teams_delete_discussion_in_org.go +++ b/MCP/go/tools/teams/teams_delete_discussion_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_delete_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s%s", cfg.BaseURL, org, team_slug, discussion_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s", cfg.BaseURL, org, team_slug, discussion_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -125,7 +94,7 @@ func Teams_delete_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte } func CreateTeams_delete_discussion_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion_number", + tool := mcp.NewTool("delete_orgs_org_teams_team_slug_discussions_discussion", mcp.WithDescription("Delete a discussion"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_delete_discussion_legacy.go b/MCP/go/tools/teams/teams_delete_discussion_legacy.go index 41f622d..897dc05 100644 --- a/MCP/go/tools/teams/teams_delete_discussion_legacy.go +++ b/MCP/go/tools/teams/teams_delete_discussion_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_delete_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/discussions/%s%s", cfg.BaseURL, team_id, discussion_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s", cfg.BaseURL, team_id, discussion_number) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_delete_in_org.go b/MCP/go/tools/teams/teams_delete_in_org.go index ff7fb74..59ef0eb 100644 --- a/MCP/go/tools/teams/teams_delete_in_org.go +++ b/MCP/go/tools/teams/teams_delete_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_delete_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_delete_legacy.go b/MCP/go/tools/teams/teams_delete_legacy.go index 95a3bd0..815d23f 100644 --- a/MCP/go/tools/teams/teams_delete_legacy.go +++ b/MCP/go/tools/teams/teams_delete_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Teams_delete_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: team_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s%s", cfg.BaseURL, team_id, queryString) + url := fmt.Sprintf("%s/teams/%s", cfg.BaseURL, team_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_get_by_name.go b/MCP/go/tools/teams/teams_get_by_name.go index d505e8c..437aef6 100644 --- a/MCP/go/tools/teams/teams_get_by_name.go +++ b/MCP/go/tools/teams/teams_get_by_name.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_get_by_nameHandler(cfg *config.APIConfig) func(ctx context.Context, r if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Teams_get_by_nameHandler(cfg *config.APIConfig) func(ctx context.Context, r return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -117,7 +86,7 @@ func Teams_get_by_nameHandler(cfg *config.APIConfig) func(ctx context.Context, r } func CreateTeams_get_by_nameTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug", + tool := mcp.NewTool("get_orgs_org_teams_team_slug_2", mcp.WithDescription("Get a team by name"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_get_discussion_comment_in_org.go b/MCP/go/tools/teams/teams_get_discussion_comment_in_org.go index f52ff49..e045516 100644 --- a/MCP/go/tools/teams/teams_get_discussion_comment_in_org.go +++ b/MCP/go/tools/teams/teams_get_discussion_comment_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Teams_get_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Teams_get_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -133,7 +102,7 @@ func Teams_get_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(ctx } func CreateTeams_get_discussion_comment_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number_comments_comment_number", + tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("Get a discussion comment"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_get_discussion_comment_legacy.go b/MCP/go/tools/teams/teams_get_discussion_comment_legacy.go index 39a9d2d..8d7e56c 100644 --- a/MCP/go/tools/teams/teams_get_discussion_comment_legacy.go +++ b/MCP/go/tools/teams/teams_get_discussion_comment_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_get_discussion_comment_legacyHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s%s", cfg.BaseURL, team_id, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s", cfg.BaseURL, team_id, discussion_number, comment_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Teams_get_discussion_comment_legacyHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Teams_get_discussion_comment_legacyHandler(cfg *config.APIConfig) func(ctx } func CreateTeams_get_discussion_comment_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_teams_team_id_discussions_discussion_number_comments_comment_number", + tool := mcp.NewTool("get_teams_team_id_discussions_discussion_number_comments", mcp.WithDescription("Get a discussion comment (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("discussion_number", mcp.Required(), mcp.Description("The number that identifies the discussion.")), diff --git a/MCP/go/tools/teams/teams_get_discussion_in_org.go b/MCP/go/tools/teams/teams_get_discussion_in_org.go index bc44cff..af7de4c 100644 --- a/MCP/go/tools/teams/teams_get_discussion_in_org.go +++ b/MCP/go/tools/teams/teams_get_discussion_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_get_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s%s", cfg.BaseURL, org, team_slug, discussion_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s", cfg.BaseURL, org, team_slug, discussion_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Teams_get_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -125,7 +94,7 @@ func Teams_get_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx context. } func CreateTeams_get_discussion_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number", + tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number_2", mcp.WithDescription("Get a discussion"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_get_discussion_legacy.go b/MCP/go/tools/teams/teams_get_discussion_legacy.go index 32a1e18..d534b28 100644 --- a/MCP/go/tools/teams/teams_get_discussion_legacy.go +++ b/MCP/go/tools/teams/teams_get_discussion_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_get_discussion_legacyHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/discussions/%s%s", cfg.BaseURL, team_id, discussion_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s", cfg.BaseURL, team_id, discussion_number) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Teams_get_discussion_legacyHandler(cfg *config.APIConfig) func(ctx context. return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_get_legacy.go b/MCP/go/tools/teams/teams_get_legacy.go index 03bdb74..b2a5251 100644 --- a/MCP/go/tools/teams/teams_get_legacy.go +++ b/MCP/go/tools/teams/teams_get_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Teams_get_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, re if !ok { return mcp.NewToolResultError("Invalid path parameter: team_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s%s", cfg.BaseURL, team_id, queryString) + url := fmt.Sprintf("%s/teams/%s", cfg.BaseURL, team_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Teams_get_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, re return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -109,7 +78,7 @@ func Teams_get_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, re } func CreateTeams_get_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_teams_team_id", + tool := mcp.NewTool("get_teams_team_id_2", mcp.WithDescription("Get a team (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), ) diff --git a/MCP/go/tools/teams/teams_get_member_legacy.go b/MCP/go/tools/teams/teams_get_member_legacy.go index 1b06ccc..7bc50f3 100644 --- a/MCP/go/tools/teams/teams_get_member_legacy.go +++ b/MCP/go/tools/teams/teams_get_member_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_get_member_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/members/%s%s", cfg.BaseURL, team_id, username, queryString) + url := fmt.Sprintf("%s/teams/%s/members/%s", cfg.BaseURL, team_id, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_get_membership_for_user_in_org.go b/MCP/go/tools/teams/teams_get_membership_for_user_in_org.go index 840ecdc..9641a67 100644 --- a/MCP/go/tools/teams/teams_get_membership_for_user_in_org.go +++ b/MCP/go/tools/teams/teams_get_membership_for_user_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_get_membership_for_user_in_orgHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/memberships/%s%s", cfg.BaseURL, org, team_slug, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/memberships/%s", cfg.BaseURL, org, team_slug, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Teams_get_membership_for_user_in_orgHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_get_membership_for_user_legacy.go b/MCP/go/tools/teams/teams_get_membership_for_user_legacy.go index 727e45e..4d7c50b 100644 --- a/MCP/go/tools/teams/teams_get_membership_for_user_legacy.go +++ b/MCP/go/tools/teams/teams_get_membership_for_user_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_get_membership_for_user_legacyHandler(cfg *config.APIConfig) func(ctx if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/memberships/%s%s", cfg.BaseURL, team_id, username, queryString) + url := fmt.Sprintf("%s/teams/%s/memberships/%s", cfg.BaseURL, team_id, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -101,7 +70,7 @@ func Teams_get_membership_for_user_legacyHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_membership if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list.go b/MCP/go/tools/teams/teams_list.go index c386ec9..44794f3 100644 --- a/MCP/go/tools/teams/teams_list.go +++ b/MCP/go/tools/teams/teams_list.go @@ -34,34 +34,6 @@ func Teams_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Teams_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Teams_listHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_child_in_org.go b/MCP/go/tools/teams/teams_list_child_in_org.go index cfeacd6..84debc8 100644 --- a/MCP/go/tools/teams/teams_list_child_in_org.go +++ b/MCP/go/tools/teams/teams_list_child_in_org.go @@ -42,34 +42,6 @@ func Teams_list_child_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Teams_list_child_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Teams_list_child_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -123,7 +98,7 @@ func Teams_list_child_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont } func CreateTeams_list_child_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug_teams", + tool := mcp.NewTool("get_orgs_org_teams_team_slug", mcp.WithDescription("List child teams"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_list_child_legacy.go b/MCP/go/tools/teams/teams_list_child_legacy.go index d8ad352..5ccc9f9 100644 --- a/MCP/go/tools/teams/teams_list_child_legacy.go +++ b/MCP/go/tools/teams/teams_list_child_legacy.go @@ -34,34 +34,6 @@ func Teams_list_child_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Teams_list_child_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Teams_list_child_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Team + var result []models.Team if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -115,7 +90,7 @@ func Teams_list_child_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont } func CreateTeams_list_child_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_teams_team_id_teams", + tool := mcp.NewTool("get_teams_team_id", mcp.WithDescription("List child teams (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("per_page", mcp.Description("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"")), diff --git a/MCP/go/tools/teams/teams_list_discussion_comments_in_org.go b/MCP/go/tools/teams/teams_list_discussion_comments_in_org.go index f41865e..e1bd2e7 100644 --- a/MCP/go/tools/teams/teams_list_discussion_comments_in_org.go +++ b/MCP/go/tools/teams/teams_list_discussion_comments_in_org.go @@ -53,34 +53,6 @@ func Teams_list_discussion_comments_in_orgHandler(cfg *config.APIConfig) func(ct if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -90,17 +62,20 @@ func Teams_list_discussion_comments_in_orgHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -118,7 +93,7 @@ func Teams_list_discussion_comments_in_orgHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -134,7 +109,7 @@ func Teams_list_discussion_comments_in_orgHandler(cfg *config.APIConfig) func(ct } func CreateTeams_list_discussion_comments_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number_comments", + tool := mcp.NewTool("get_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("List discussion comments"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_list_discussion_comments_legacy.go b/MCP/go/tools/teams/teams_list_discussion_comments_legacy.go index 54aad31..279e7e9 100644 --- a/MCP/go/tools/teams/teams_list_discussion_comments_legacy.go +++ b/MCP/go/tools/teams/teams_list_discussion_comments_legacy.go @@ -45,34 +45,6 @@ func Teams_list_discussion_comments_legacyHandler(cfg *config.APIConfig) func(ct if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Teams_list_discussion_comments_legacyHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Teams_list_discussion_comments_legacyHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_discussions_in_org.go b/MCP/go/tools/teams/teams_list_discussions_in_org.go index b437b9b..d9fb935 100644 --- a/MCP/go/tools/teams/teams_list_discussions_in_org.go +++ b/MCP/go/tools/teams/teams_list_discussions_in_org.go @@ -48,34 +48,6 @@ func Teams_list_discussions_in_orgHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["pinned"]; ok { queryParams = append(queryParams, fmt.Sprintf("pinned=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Teams_list_discussions_in_orgHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -113,7 +88,7 @@ func Teams_list_discussions_in_orgHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_discussions_legacy.go b/MCP/go/tools/teams/teams_list_discussions_legacy.go index d731d5f..2d6a883 100644 --- a/MCP/go/tools/teams/teams_list_discussions_legacy.go +++ b/MCP/go/tools/teams/teams_list_discussions_legacy.go @@ -37,34 +37,6 @@ func Teams_list_discussions_legacyHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Teams_list_discussions_legacyHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Teams_list_discussions_legacyHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_for_authenticated_user.go b/MCP/go/tools/teams/teams_list_for_authenticated_user.go index 5472078..bc1c45f 100644 --- a/MCP/go/tools/teams/teams_list_for_authenticated_user.go +++ b/MCP/go/tools/teams/teams_list_for_authenticated_user.go @@ -26,34 +26,6 @@ func Teams_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Teams_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Teams_list_for_authenticated_userHandler(cfg *config.APIConfig) func(ctx co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_members_in_org.go b/MCP/go/tools/teams/teams_list_members_in_org.go index 3d8e9b1..b8f777c 100644 --- a/MCP/go/tools/teams/teams_list_members_in_org.go +++ b/MCP/go/tools/teams/teams_list_members_in_org.go @@ -45,34 +45,6 @@ func Teams_list_members_in_orgHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -82,17 +54,20 @@ func Teams_list_members_in_orgHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -110,7 +85,7 @@ func Teams_list_members_in_orgHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_members_legacy.go b/MCP/go/tools/teams/teams_list_members_legacy.go index 2d65e53..5f897fb 100644 --- a/MCP/go/tools/teams/teams_list_members_legacy.go +++ b/MCP/go/tools/teams/teams_list_members_legacy.go @@ -37,34 +37,6 @@ func Teams_list_members_legacyHandler(cfg *config.APIConfig) func(ctx context.Co if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -74,17 +46,20 @@ func Teams_list_members_legacyHandler(cfg *config.APIConfig) func(ctx context.Co if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -102,7 +77,7 @@ func Teams_list_members_legacyHandler(cfg *config.APIConfig) func(ctx context.Co return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_pending_invitations_in_org.go b/MCP/go/tools/teams/teams_list_pending_invitations_in_org.go index aae5aee..0ff4390 100644 --- a/MCP/go/tools/teams/teams_list_pending_invitations_in_org.go +++ b/MCP/go/tools/teams/teams_list_pending_invitations_in_org.go @@ -42,34 +42,6 @@ func Teams_list_pending_invitations_in_orgHandler(cfg *config.APIConfig) func(ct if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Teams_list_pending_invitations_in_orgHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Teams_list_pending_invitations_in_orgHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_pending_invitations_legacy.go b/MCP/go/tools/teams/teams_list_pending_invitations_legacy.go index c24f0ea..60b8cb5 100644 --- a/MCP/go/tools/teams/teams_list_pending_invitations_legacy.go +++ b/MCP/go/tools/teams/teams_list_pending_invitations_legacy.go @@ -34,34 +34,6 @@ func Teams_list_pending_invitations_legacyHandler(cfg *config.APIConfig) func(ct if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Teams_list_pending_invitations_legacyHandler(cfg *config.APIConfig) func(ct if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Teams_list_pending_invitations_legacyHandler(cfg *config.APIConfig) func(ct return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Organization_invitation if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_projects_in_org.go b/MCP/go/tools/teams/teams_list_projects_in_org.go index d49a0da..be0397a 100644 --- a/MCP/go/tools/teams/teams_list_projects_in_org.go +++ b/MCP/go/tools/teams/teams_list_projects_in_org.go @@ -42,34 +42,6 @@ func Teams_list_projects_in_orgHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Teams_list_projects_in_orgHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Teams_list_projects_in_orgHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_projects_legacy.go b/MCP/go/tools/teams/teams_list_projects_legacy.go index da35df7..32bdc9b 100644 --- a/MCP/go/tools/teams/teams_list_projects_legacy.go +++ b/MCP/go/tools/teams/teams_list_projects_legacy.go @@ -34,34 +34,6 @@ func Teams_list_projects_legacyHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Teams_list_projects_legacyHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Teams_list_projects_legacyHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Team_project if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_repos_in_org.go b/MCP/go/tools/teams/teams_list_repos_in_org.go index cf2ae4c..795a8f1 100644 --- a/MCP/go/tools/teams/teams_list_repos_in_org.go +++ b/MCP/go/tools/teams/teams_list_repos_in_org.go @@ -42,34 +42,6 @@ func Teams_list_repos_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -79,17 +51,20 @@ func Teams_list_repos_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -107,7 +82,7 @@ func Teams_list_repos_in_orgHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_list_repos_legacy.go b/MCP/go/tools/teams/teams_list_repos_legacy.go index 510eea1..5ef6249 100644 --- a/MCP/go/tools/teams/teams_list_repos_legacy.go +++ b/MCP/go/tools/teams/teams_list_repos_legacy.go @@ -34,34 +34,6 @@ func Teams_list_repos_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Teams_list_repos_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Teams_list_repos_legacyHandler(cfg *config.APIConfig) func(ctx context.Cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Minimal_repository if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_remove_member_legacy.go b/MCP/go/tools/teams/teams_remove_member_legacy.go index 1939880..cb8e8d0 100644 --- a/MCP/go/tools/teams/teams_remove_member_legacy.go +++ b/MCP/go/tools/teams/teams_remove_member_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_remove_member_legacyHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/members/%s%s", cfg.BaseURL, team_id, username, queryString) + url := fmt.Sprintf("%s/teams/%s/members/%s", cfg.BaseURL, team_id, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_remove_membership_for_user_in_org.go b/MCP/go/tools/teams/teams_remove_membership_for_user_in_org.go index 15685b5..0c710ae 100644 --- a/MCP/go/tools/teams/teams_remove_membership_for_user_in_org.go +++ b/MCP/go/tools/teams/teams_remove_membership_for_user_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_remove_membership_for_user_in_orgHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/memberships/%s%s", cfg.BaseURL, org, team_slug, username, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/memberships/%s", cfg.BaseURL, org, team_slug, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_remove_membership_for_user_legacy.go b/MCP/go/tools/teams/teams_remove_membership_for_user_legacy.go index e41996b..a7e8670 100644 --- a/MCP/go/tools/teams/teams_remove_membership_for_user_legacy.go +++ b/MCP/go/tools/teams/teams_remove_membership_for_user_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_remove_membership_for_user_legacyHandler(cfg *config.APIConfig) func( if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/memberships/%s%s", cfg.BaseURL, team_id, username, queryString) + url := fmt.Sprintf("%s/teams/%s/memberships/%s", cfg.BaseURL, team_id, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_remove_project_in_org.go b/MCP/go/tools/teams/teams_remove_project_in_org.go index 5635d14..5e315ca 100644 --- a/MCP/go/tools/teams/teams_remove_project_in_org.go +++ b/MCP/go/tools/teams/teams_remove_project_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_remove_project_in_orgHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/projects/%s%s", cfg.BaseURL, org, team_slug, project_id, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/projects/%s", cfg.BaseURL, org, team_slug, project_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_remove_project_legacy.go b/MCP/go/tools/teams/teams_remove_project_legacy.go index a7464e0..62d3794 100644 --- a/MCP/go/tools/teams/teams_remove_project_legacy.go +++ b/MCP/go/tools/teams/teams_remove_project_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Teams_remove_project_legacyHandler(cfg *config.APIConfig) func(ctx context. if !ok { return mcp.NewToolResultError("Invalid path parameter: project_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/projects/%s%s", cfg.BaseURL, team_id, project_id, queryString) + url := fmt.Sprintf("%s/teams/%s/projects/%s", cfg.BaseURL, team_id, project_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Teams_remove_project_legacyHandler(cfg *config.APIConfig) func(ctx context. } func CreateTeams_remove_project_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_teams_team_id_projects_project_id", + tool := mcp.NewTool("delete_teams_team_id_projects_project", mcp.WithDescription("Remove a project from a team (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("project_id", mcp.Required(), mcp.Description("The unique identifier of the project.")), diff --git a/MCP/go/tools/teams/teams_remove_repo_in_org.go b/MCP/go/tools/teams/teams_remove_repo_in_org.go index aebae97..cc52f36 100644 --- a/MCP/go/tools/teams/teams_remove_repo_in_org.go +++ b/MCP/go/tools/teams/teams_remove_repo_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -51,55 +50,25 @@ func Teams_remove_repo_in_orgHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/repos/%s/%s%s", cfg.BaseURL, org, team_slug, owner, repo, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/repos/%s/%s", cfg.BaseURL, org, team_slug, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_remove_repo_legacy.go b/MCP/go/tools/teams/teams_remove_repo_legacy.go index 144abc5..74b8af9 100644 --- a/MCP/go/tools/teams/teams_remove_repo_legacy.go +++ b/MCP/go/tools/teams/teams_remove_repo_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -43,55 +42,25 @@ func Teams_remove_repo_legacyHandler(cfg *config.APIConfig) func(ctx context.Con if !ok { return mcp.NewToolResultError("Invalid path parameter: repo"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/teams/%s/repos/%s/%s%s", cfg.BaseURL, team_id, owner, repo, queryString) + url := fmt.Sprintf("%s/teams/%s/repos/%s/%s", cfg.BaseURL, team_id, owner, repo) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/teams/teams_update_discussion_comment_in_org.go b/MCP/go/tools/teams/teams_update_discussion_comment_in_org.go index 1a54e55..b3d3ec7 100644 --- a/MCP/go/tools/teams/teams_update_discussion_comment_in_org.go +++ b/MCP/go/tools/teams/teams_update_discussion_comment_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -52,39 +51,6 @@ func Teams_update_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -101,23 +67,26 @@ func Teams_update_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s/comments/%s", cfg.BaseURL, org, team_slug, discussion_number, comment_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -135,7 +104,7 @@ func Teams_update_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -151,7 +120,7 @@ func Teams_update_discussion_comment_in_orgHandler(cfg *config.APIConfig) func(c } func CreateTeams_update_discussion_comment_in_orgTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_orgs_org_teams_team_slug_discussions_discussion_number_comments_comment_number", + tool := mcp.NewTool("patch_orgs_org_teams_team_slug_discussions_discussion_number", mcp.WithDescription("Update a discussion comment"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), diff --git a/MCP/go/tools/teams/teams_update_discussion_comment_legacy.go b/MCP/go/tools/teams/teams_update_discussion_comment_legacy.go index 7a7dd7e..07099e3 100644 --- a/MCP/go/tools/teams/teams_update_discussion_comment_legacy.go +++ b/MCP/go/tools/teams/teams_update_discussion_comment_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Teams_update_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid path parameter: comment_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Teams_update_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s%s", cfg.BaseURL, team_id, discussion_number, comment_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s/comments/%s", cfg.BaseURL, team_id, discussion_number, comment_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Teams_update_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion_comment if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -143,7 +112,7 @@ func Teams_update_discussion_comment_legacyHandler(cfg *config.APIConfig) func(c } func CreateTeams_update_discussion_comment_legacyTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("patch_teams_team_id_discussions_discussion_number_comments_comment_number", + tool := mcp.NewTool("patch_teams_team_id_discussions_discussion_number_comments", mcp.WithDescription("Update a discussion comment (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), mcp.WithNumber("discussion_number", mcp.Required(), mcp.Description("The number that identifies the discussion.")), diff --git a/MCP/go/tools/teams/teams_update_discussion_in_org.go b/MCP/go/tools/teams/teams_update_discussion_in_org.go index 8b63d95..196eddf 100644 --- a/MCP/go/tools/teams/teams_update_discussion_in_org.go +++ b/MCP/go/tools/teams/teams_update_discussion_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -44,39 +43,6 @@ func Teams_update_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -93,23 +59,26 @@ func Teams_update_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s%s", cfg.BaseURL, org, team_slug, discussion_number, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s/discussions/%s", cfg.BaseURL, org, team_slug, discussion_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -127,7 +96,7 @@ func Teams_update_discussion_in_orgHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_update_discussion_legacy.go b/MCP/go/tools/teams/teams_update_discussion_legacy.go index 004cbe5..76666ec 100644 --- a/MCP/go/tools/teams/teams_update_discussion_legacy.go +++ b/MCP/go/tools/teams/teams_update_discussion_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Teams_update_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: discussion_number"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Teams_update_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s/discussions/%s%s", cfg.BaseURL, team_id, discussion_number, queryString) + url := fmt.Sprintf("%s/teams/%s/discussions/%s", cfg.BaseURL, team_id, discussion_number) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Teams_update_discussion_legacyHandler(cfg *config.APIConfig) func(ctx conte return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_discussion if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/teams/teams_update_in_org.go b/MCP/go/tools/teams/teams_update_in_org.go index 41c27b0..0fea2b8 100644 --- a/MCP/go/tools/teams/teams_update_in_org.go +++ b/MCP/go/tools/teams/teams_update_in_org.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -36,39 +35,6 @@ func Teams_update_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: team_slug"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -85,23 +51,26 @@ func Teams_update_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/orgs/%s/teams/%s%s", cfg.BaseURL, org, team_slug, queryString) + url := fmt.Sprintf("%s/orgs/%s/teams/%s", cfg.BaseURL, org, team_slug) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -119,7 +88,7 @@ func Teams_update_in_orgHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -139,12 +108,12 @@ func CreateTeams_update_in_orgTool(cfg *config.APIConfig) models.Tool { mcp.WithDescription("Update a team"), mcp.WithString("org", mcp.Required(), mcp.Description("The organization name. The name is not case sensitive.")), mcp.WithString("team_slug", mcp.Required(), mcp.Description("The slug of the team name.")), - mcp.WithString("permission", mcp.Description("Input parameter: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified.")), - mcp.WithString("privacy", mcp.Description("Input parameter: The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. When a team is nested, the `privacy` for parent teams cannot be `secret`. The options are: \n**For a non-nested team:** \n * `secret` - only visible to organization owners and members of this team. \n * `closed` - visible to all members of this organization. \n**For a parent or child team:** \n * `closed` - visible to all members of this organization.")), - mcp.WithString("description", mcp.Description("Input parameter: The description of the team.")), mcp.WithString("name", mcp.Description("Input parameter: The name of the team.")), mcp.WithString("notification_setting", mcp.Description("Input parameter: The notification setting the team has chosen. Editing teams without specifying this parameter leaves `notification_setting` intact. The options are: \n * `notifications_enabled` - team members receive notifications when the team is @mentioned. \n * `notifications_disabled` - no one receives notifications.")), mcp.WithNumber("parent_team_id", mcp.Description("Input parameter: The ID of a team to set as the parent team.")), + mcp.WithString("permission", mcp.Description("Input parameter: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified.")), + mcp.WithString("privacy", mcp.Description("Input parameter: The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. When a team is nested, the `privacy` for parent teams cannot be `secret`. The options are: \n**For a non-nested team:** \n * `secret` - only visible to organization owners and members of this team. \n * `closed` - visible to all members of this organization. \n**For a parent or child team:** \n * `closed` - visible to all members of this organization.")), + mcp.WithString("description", mcp.Description("Input parameter: The description of the team.")), ) return models.Tool{ diff --git a/MCP/go/tools/teams/teams_update_legacy.go b/MCP/go/tools/teams/teams_update_legacy.go index 77f8c3e..330a6dc 100644 --- a/MCP/go/tools/teams/teams_update_legacy.go +++ b/MCP/go/tools/teams/teams_update_legacy.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Teams_update_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: team_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -77,23 +43,26 @@ func Teams_update_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/teams/%s%s", cfg.BaseURL, team_id, queryString) + url := fmt.Sprintf("%s/teams/%s", cfg.BaseURL, team_id) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -111,7 +80,7 @@ func Teams_update_legacyHandler(cfg *config.APIConfig) func(ctx context.Context, return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Team_full if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -130,12 +99,12 @@ func CreateTeams_update_legacyTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("patch_teams_team_id", mcp.WithDescription("Update a team (Legacy)"), mcp.WithNumber("team_id", mcp.Required(), mcp.Description("The unique identifier of the team.")), - mcp.WithString("permission", mcp.Description("Input parameter: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified.")), - mcp.WithString("privacy", mcp.Description("Input parameter: The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. The options are: \n**For a non-nested team:** \n * `secret` - only visible to organization owners and members of this team. \n * `closed` - visible to all members of this organization. \n**For a parent or child team:** \n * `closed` - visible to all members of this organization.")), - mcp.WithString("description", mcp.Description("Input parameter: The description of the team.")), mcp.WithString("name", mcp.Required(), mcp.Description("Input parameter: The name of the team.")), mcp.WithString("notification_setting", mcp.Description("Input parameter: The notification setting the team has chosen. Editing teams without specifying this parameter leaves `notification_setting` intact. The options are: \n * `notifications_enabled` - team members receive notifications when the team is @mentioned. \n * `notifications_disabled` - no one receives notifications.")), mcp.WithNumber("parent_team_id", mcp.Description("Input parameter: The ID of a team to set as the parent team.")), + mcp.WithString("permission", mcp.Description("Input parameter: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified.")), + mcp.WithString("privacy", mcp.Description("Input parameter: The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. The options are: \n**For a non-nested team:** \n * `secret` - only visible to organization owners and members of this team. \n * `closed` - visible to all members of this organization. \n**For a parent or child team:** \n * `closed` - visible to all members of this organization.")), + mcp.WithString("description", mcp.Description("Input parameter: The description of the team.")), ) return models.Tool{ diff --git a/MCP/go/tools/users/users_add_email_for_authenticated_user.go b/MCP/go/tools/users/users_add_email_for_authenticated_user.go index 8b4bae2..a123c51 100644 --- a/MCP/go/tools/users/users_add_email_for_authenticated_user.go +++ b/MCP/go/tools/users/users_add_email_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_add_email_for_authenticated_userHandler(cfg *config.APIConfig) func(c if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -69,23 +35,26 @@ func Users_add_email_for_authenticated_userHandler(cfg *config.APIConfig) func(c if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/emails%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/emails", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Users_add_email_for_authenticated_userHandler(cfg *config.APIConfig) func(c return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Email + var result []models.Email if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_add_social_account_for_authenticated_user.go b/MCP/go/tools/users/users_add_social_account_for_authenticated_user.go index 177403e..5700195 100644 --- a/MCP/go/tools/users/users_add_social_account_for_authenticated_user.go +++ b/MCP/go/tools/users/users_add_social_account_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_add_social_account_for_authenticated_userHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_add_social_account_for_authenticated_userHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/social_accounts%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/social_accounts", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Users_add_social_account_for_authenticated_userHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Social_account if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_block.go b/MCP/go/tools/users/users_block.go index 67e72cb..c78cffc 100644 --- a/MCP/go/tools/users/users_block.go +++ b/MCP/go/tools/users/users_block.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_blockHandler(cfg *config.APIConfig) func(ctx context.Context, request if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/blocks/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/user/blocks/%s", cfg.BaseURL, username) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_check_blocked.go b/MCP/go/tools/users/users_check_blocked.go index 18eb0b4..efe1a5f 100644 --- a/MCP/go/tools/users/users_check_blocked.go +++ b/MCP/go/tools/users/users_check_blocked.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_check_blockedHandler(cfg *config.APIConfig) func(ctx context.Context, if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/blocks/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/user/blocks/%s", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_check_following_for_user.go b/MCP/go/tools/users/users_check_following_for_user.go index 943c5a1..2b39ebb 100644 --- a/MCP/go/tools/users/users_check_following_for_user.go +++ b/MCP/go/tools/users/users_check_following_for_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Users_check_following_for_userHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: target_user"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/following/%s%s", cfg.BaseURL, username, target_user, queryString) + url := fmt.Sprintf("%s/users/%s/following/%s", cfg.BaseURL, username, target_user) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_check_person_is_followed_by_authenticated.go b/MCP/go/tools/users/users_check_person_is_followed_by_authenticated.go index fbdff4f..6e5111a 100644 --- a/MCP/go/tools/users/users_check_person_is_followed_by_authenticated.go +++ b/MCP/go/tools/users/users_check_person_is_followed_by_authenticated.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_check_person_is_followed_by_authenticatedHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/following/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/user/following/%s", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_create_gpg_key_for_authenticated_user.go b/MCP/go/tools/users/users_create_gpg_key_for_authenticated_user.go index 4ad78e5..ad081fb 100644 --- a/MCP/go/tools/users/users_create_gpg_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_create_gpg_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_create_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_create_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/gpg_keys%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/gpg_keys", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Users_create_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gpg_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -121,8 +90,8 @@ func Users_create_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) f func CreateUsers_create_gpg_key_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("post_user_gpg_keys", mcp.WithDescription("Create a GPG key for the authenticated user"), - mcp.WithString("armored_public_key", mcp.Required(), mcp.Description("Input parameter: A GPG key in ASCII-armored format.")), mcp.WithString("name", mcp.Description("Input parameter: A descriptive name for the new key.")), + mcp.WithString("armored_public_key", mcp.Required(), mcp.Description("Input parameter: A GPG key in ASCII-armored format.")), ) return models.Tool{ diff --git a/MCP/go/tools/users/users_create_public_ssh_key_for_authenticated_user.go b/MCP/go/tools/users/users_create_public_ssh_key_for_authenticated_user.go index e1c067b..9415a6a 100644 --- a/MCP/go/tools/users/users_create_public_ssh_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_create_public_ssh_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_create_public_ssh_key_for_authenticated_userHandler(cfg *config.APICo if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_create_public_ssh_key_for_authenticated_userHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/keys%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/keys", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_create_ssh_signing_key_for_authenticated_user.go b/MCP/go/tools/users/users_create_ssh_signing_key_for_authenticated_user.go index 64d0325..f1739ed 100644 --- a/MCP/go/tools/users/users_create_ssh_signing_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_create_ssh_signing_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_create_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_create_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIC if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/ssh_signing_keys%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/ssh_signing_keys", cfg.BaseURL) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Users_create_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIC return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Ssh_signing_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_delete_attestations_bulk.go b/MCP/go/tools/users/users_delete_attestations_bulk.go index 032e0ee..acd1e9b 100644 --- a/MCP/go/tools/users/users_delete_attestations_bulk.go +++ b/MCP/go/tools/users/users_delete_attestations_bulk.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -28,39 +27,6 @@ func Users_delete_attestations_bulkHandler(cfg *config.APIConfig) func(ctx conte if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -77,23 +43,26 @@ func Users_delete_attestations_bulkHandler(cfg *config.APIConfig) func(ctx conte if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/users/%s/attestations/delete-request%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s/attestations/delete-request", cfg.BaseURL, username) req, err := http.NewRequest("POST", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_delete_attestations_by_id.go b/MCP/go/tools/users/users_delete_attestations_by_id.go index b313f5d..bc9372b 100644 --- a/MCP/go/tools/users/users_delete_attestations_by_id.go +++ b/MCP/go/tools/users/users_delete_attestations_by_id.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Users_delete_attestations_by_idHandler(cfg *config.APIConfig) func(ctx cont if !ok { return mcp.NewToolResultError("Invalid path parameter: attestation_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/attestations/%s%s", cfg.BaseURL, username, attestation_id, queryString) + url := fmt.Sprintf("%s/users/%s/attestations/%s", cfg.BaseURL, username, attestation_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_delete_attestations_by_subject_digest.go b/MCP/go/tools/users/users_delete_attestations_by_subject_digest.go index 5389281..aa9494e 100644 --- a/MCP/go/tools/users/users_delete_attestations_by_subject_digest.go +++ b/MCP/go/tools/users/users_delete_attestations_by_subject_digest.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -35,55 +34,25 @@ func Users_delete_attestations_by_subject_digestHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: subject_digest"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s/attestations/digest/%s%s", cfg.BaseURL, username, subject_digest, queryString) + url := fmt.Sprintf("%s/users/%s/attestations/digest/%s", cfg.BaseURL, username, subject_digest) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -117,7 +86,7 @@ func Users_delete_attestations_by_subject_digestHandler(cfg *config.APIConfig) f } func CreateUsers_delete_attestations_by_subject_digestTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_users_username_attestations_digest_subject_digest", + tool := mcp.NewTool("delete_users_username_attestations_digest_subject", mcp.WithDescription("Delete attestations by subject digest"), mcp.WithString("username", mcp.Required(), mcp.Description("The handle for the GitHub user account.")), mcp.WithString("subject_digest", mcp.Required(), mcp.Description("Subject Digest")), diff --git a/MCP/go/tools/users/users_delete_email_for_authenticated_user.go b/MCP/go/tools/users/users_delete_email_for_authenticated_user.go index 1f79b16..82465b3 100644 --- a/MCP/go/tools/users/users_delete_email_for_authenticated_user.go +++ b/MCP/go/tools/users/users_delete_email_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_delete_email_for_authenticated_userHandler(cfg *config.APIConfig) fun if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody interface{} @@ -69,23 +35,26 @@ func Users_delete_email_for_authenticated_userHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/emails%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/emails", cfg.BaseURL) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_delete_gpg_key_for_authenticated_user.go b/MCP/go/tools/users/users_delete_gpg_key_for_authenticated_user.go index ce36944..d641227 100644 --- a/MCP/go/tools/users/users_delete_gpg_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_delete_gpg_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_delete_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) f if !ok { return mcp.NewToolResultError("Invalid path parameter: gpg_key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/gpg_keys/%s%s", cfg.BaseURL, gpg_key_id, queryString) + url := fmt.Sprintf("%s/user/gpg_keys/%s", cfg.BaseURL, gpg_key_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Users_delete_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) f } func CreateUsers_delete_gpg_key_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_user_gpg_keys_gpg_key_id", + tool := mcp.NewTool("delete_user_gpg_keys_key_id", mcp.WithDescription("Delete a GPG key for the authenticated user"), mcp.WithNumber("gpg_key_id", mcp.Required(), mcp.Description("The unique identifier of the GPG key.")), ) diff --git a/MCP/go/tools/users/users_delete_public_ssh_key_for_authenticated_user.go b/MCP/go/tools/users/users_delete_public_ssh_key_for_authenticated_user.go index 6986e59..9b173dd 100644 --- a/MCP/go/tools/users/users_delete_public_ssh_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_delete_public_ssh_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_delete_public_ssh_key_for_authenticated_userHandler(cfg *config.APICo if !ok { return mcp.NewToolResultError("Invalid path parameter: key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/keys/%s%s", cfg.BaseURL, key_id, queryString) + url := fmt.Sprintf("%s/user/keys/%s", cfg.BaseURL, key_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_delete_social_account_for_authenticated_user.go b/MCP/go/tools/users/users_delete_social_account_for_authenticated_user.go index f5fa0bc..01651a3 100644 --- a/MCP/go/tools/users/users_delete_social_account_for_authenticated_user.go +++ b/MCP/go/tools/users/users_delete_social_account_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_delete_social_account_for_authenticated_userHandler(cfg *config.APICo if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_delete_social_account_for_authenticated_userHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/social_accounts%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/social_accounts", cfg.BaseURL) req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_delete_ssh_signing_key_for_authenticated_user.go b/MCP/go/tools/users/users_delete_ssh_signing_key_for_authenticated_user.go index 9069de9..65567a6 100644 --- a/MCP/go/tools/users/users_delete_ssh_signing_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_delete_ssh_signing_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_delete_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIC if !ok { return mcp.NewToolResultError("Invalid path parameter: ssh_signing_key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/ssh_signing_keys/%s%s", cfg.BaseURL, ssh_signing_key_id, queryString) + url := fmt.Sprintf("%s/user/ssh_signing_keys/%s", cfg.BaseURL, ssh_signing_key_id) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -109,7 +78,7 @@ func Users_delete_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIC } func CreateUsers_delete_ssh_signing_key_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("delete_user_ssh_signing_keys_ssh_signing_key_id", + tool := mcp.NewTool("delete_user_ssh_signing_keys_key_id", mcp.WithDescription("Delete an SSH signing key for the authenticated user"), mcp.WithNumber("ssh_signing_key_id", mcp.Required(), mcp.Description("The unique identifier of the SSH signing key.")), ) diff --git a/MCP/go/tools/users/users_follow.go b/MCP/go/tools/users/users_follow.go index 4918fac..147ca43 100644 --- a/MCP/go/tools/users/users_follow.go +++ b/MCP/go/tools/users/users_follow.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_followHandler(cfg *config.APIConfig) func(ctx context.Context, reques if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/following/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/user/following/%s", cfg.BaseURL, username) req, err := http.NewRequest("PUT", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_get_authenticated.go b/MCP/go/tools/users/users_get_authenticated.go index ce2d922..d3acb6f 100644 --- a/MCP/go/tools/users/users_get_authenticated.go +++ b/MCP/go/tools/users/users_get_authenticated.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -15,55 +14,25 @@ import ( func Users_get_authenticatedHandler(cfg *config.APIConfig) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user", cfg.BaseURL) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_get_by_id.go b/MCP/go/tools/users/users_get_by_id.go index 9642576..1761139 100644 --- a/MCP/go/tools/users/users_get_by_id.go +++ b/MCP/go/tools/users/users_get_by_id.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_get_by_idHandler(cfg *config.APIConfig) func(ctx context.Context, req if !ok { return mcp.NewToolResultError("Invalid path parameter: account_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/%s%s", cfg.BaseURL, account_id, queryString) + url := fmt.Sprintf("%s/user/%s", cfg.BaseURL, account_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_get_by_username.go b/MCP/go/tools/users/users_get_by_username.go index 8152e4c..d08e1d0 100644 --- a/MCP/go/tools/users/users_get_by_username.go +++ b/MCP/go/tools/users/users_get_by_username.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_get_by_usernameHandler(cfg *config.APIConfig) func(ctx context.Contex if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/users/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/users/%s", cfg.BaseURL, username) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_get_context_for_user.go b/MCP/go/tools/users/users_get_context_for_user.go index 3e98102..c2d60d9 100644 --- a/MCP/go/tools/users/users_get_context_for_user.go +++ b/MCP/go/tools/users/users_get_context_for_user.go @@ -34,34 +34,6 @@ func Users_get_context_for_userHandler(cfg *config.APIConfig) func(ctx context.C if val, ok := args["subject_id"]; ok { queryParams = append(queryParams, fmt.Sprintf("subject_id=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_get_context_for_userHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_get_gpg_key_for_authenticated_user.go b/MCP/go/tools/users/users_get_gpg_key_for_authenticated_user.go index df91d3a..eae1b1e 100644 --- a/MCP/go/tools/users/users_get_gpg_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_get_gpg_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_get_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) func if !ok { return mcp.NewToolResultError("Invalid path parameter: gpg_key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/gpg_keys/%s%s", cfg.BaseURL, gpg_key_id, queryString) + url := fmt.Sprintf("%s/user/gpg_keys/%s", cfg.BaseURL, gpg_key_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Users_get_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Gpg_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -109,7 +78,7 @@ func Users_get_gpg_key_for_authenticated_userHandler(cfg *config.APIConfig) func } func CreateUsers_get_gpg_key_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_user_gpg_keys_gpg_key_id", + tool := mcp.NewTool("get_user_gpg_keys_key_id", mcp.WithDescription("Get a GPG key for the authenticated user"), mcp.WithNumber("gpg_key_id", mcp.Required(), mcp.Description("The unique identifier of the GPG key.")), ) diff --git a/MCP/go/tools/users/users_get_public_ssh_key_for_authenticated_user.go b/MCP/go/tools/users/users_get_public_ssh_key_for_authenticated_user.go index 9ae054d..0c77780 100644 --- a/MCP/go/tools/users/users_get_public_ssh_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_get_public_ssh_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_get_public_ssh_key_for_authenticated_userHandler(cfg *config.APIConfi if !ok { return mcp.NewToolResultError("Invalid path parameter: key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/keys/%s%s", cfg.BaseURL, key_id, queryString) + url := fmt.Sprintf("%s/user/keys/%s", cfg.BaseURL, key_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_get_ssh_signing_key_for_authenticated_user.go b/MCP/go/tools/users/users_get_ssh_signing_key_for_authenticated_user.go index aaf7690..09e25e5 100644 --- a/MCP/go/tools/users/users_get_ssh_signing_key_for_authenticated_user.go +++ b/MCP/go/tools/users/users_get_ssh_signing_key_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_get_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIConf if !ok { return mcp.NewToolResultError("Invalid path parameter: ssh_signing_key_id"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/ssh_signing_keys/%s%s", cfg.BaseURL, ssh_signing_key_id, queryString) + url := fmt.Sprintf("%s/user/ssh_signing_keys/%s", cfg.BaseURL, ssh_signing_key_id) req, err := http.NewRequest("GET", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -93,7 +62,7 @@ func Users_get_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIConf return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Ssh_signing_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -109,7 +78,7 @@ func Users_get_ssh_signing_key_for_authenticated_userHandler(cfg *config.APIConf } func CreateUsers_get_ssh_signing_key_for_authenticated_userTool(cfg *config.APIConfig) models.Tool { - tool := mcp.NewTool("get_user_ssh_signing_keys_ssh_signing_key_id", + tool := mcp.NewTool("get_user_ssh_signing_keys_key_id", mcp.WithDescription("Get an SSH signing key for the authenticated user"), mcp.WithNumber("ssh_signing_key_id", mcp.Required(), mcp.Description("The unique identifier of the SSH signing key.")), ) diff --git a/MCP/go/tools/users/users_list.go b/MCP/go/tools/users/users_list.go index 7daa49c..b803b56 100644 --- a/MCP/go/tools/users/users_list.go +++ b/MCP/go/tools/users/users_list.go @@ -26,34 +26,6 @@ func Users_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if val, ok := args["per_page"]; ok { queryParams = append(queryParams, fmt.Sprintf("per_page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_listHandler(cfg *config.APIConfig) func(ctx context.Context, request if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_listHandler(cfg *config.APIConfig) func(ctx context.Context, request return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_attestations.go b/MCP/go/tools/users/users_list_attestations.go index 1c6eafd..1086078 100644 --- a/MCP/go/tools/users/users_list_attestations.go +++ b/MCP/go/tools/users/users_list_attestations.go @@ -48,34 +48,6 @@ func Users_list_attestationsHandler(cfg *config.APIConfig) func(ctx context.Cont if val, ok := args["predicate_type"]; ok { queryParams = append(queryParams, fmt.Sprintf("predicate_type=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -85,17 +57,20 @@ func Users_list_attestationsHandler(cfg *config.APIConfig) func(ctx context.Cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_list_attestations_bulk.go b/MCP/go/tools/users/users_list_attestations_bulk.go index 879f368..d53d480 100644 --- a/MCP/go/tools/users/users_list_attestations_bulk.go +++ b/MCP/go/tools/users/users_list_attestations_bulk.go @@ -38,34 +38,6 @@ func Users_list_attestations_bulkHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["after"]; ok { queryParams = append(queryParams, fmt.Sprintf("after=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -92,17 +64,20 @@ func Users_list_attestations_bulkHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_list_blocked_by_authenticated_user.go b/MCP/go/tools/users/users_list_blocked_by_authenticated_user.go index f4b2d95..6fd0862 100644 --- a/MCP/go/tools/users/users_list_blocked_by_authenticated_user.go +++ b/MCP/go/tools/users/users_list_blocked_by_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_blocked_by_authenticated_userHandler(cfg *config.APIConfig) func if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_blocked_by_authenticated_userHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_blocked_by_authenticated_userHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_emails_for_authenticated_user.go b/MCP/go/tools/users/users_list_emails_for_authenticated_user.go index 02bbfa5..f933ff4 100644 --- a/MCP/go/tools/users/users_list_emails_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_emails_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_emails_for_authenticated_userHandler(cfg *config.APIConfig) func if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_emails_for_authenticated_userHandler(cfg *config.APIConfig) func if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_emails_for_authenticated_userHandler(cfg *config.APIConfig) func return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Email + var result []models.Email if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_followed_by_authenticated_user.go b/MCP/go/tools/users/users_list_followed_by_authenticated_user.go index 69b435f..7a3ed25 100644 --- a/MCP/go/tools/users/users_list_followed_by_authenticated_user.go +++ b/MCP/go/tools/users/users_list_followed_by_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_followed_by_authenticated_userHandler(cfg *config.APIConfig) fun if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_followed_by_authenticated_userHandler(cfg *config.APIConfig) fun if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_followed_by_authenticated_userHandler(cfg *config.APIConfig) fun return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_followers_for_authenticated_user.go b/MCP/go/tools/users/users_list_followers_for_authenticated_user.go index cf342e9..f0cc671 100644 --- a/MCP/go/tools/users/users_list_followers_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_followers_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_followers_for_authenticated_userHandler(cfg *config.APIConfig) f if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_followers_for_authenticated_userHandler(cfg *config.APIConfig) f if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_followers_for_authenticated_userHandler(cfg *config.APIConfig) f return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_followers_for_user.go b/MCP/go/tools/users/users_list_followers_for_user.go index f56a588..91d7597 100644 --- a/MCP/go/tools/users/users_list_followers_for_user.go +++ b/MCP/go/tools/users/users_list_followers_for_user.go @@ -34,34 +34,6 @@ func Users_list_followers_for_userHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_list_followers_for_userHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Users_list_followers_for_userHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_following_for_user.go b/MCP/go/tools/users/users_list_following_for_user.go index 7e8915c..bcc610a 100644 --- a/MCP/go/tools/users/users_list_following_for_user.go +++ b/MCP/go/tools/users/users_list_following_for_user.go @@ -34,34 +34,6 @@ func Users_list_following_for_userHandler(cfg *config.APIConfig) func(ctx contex if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_list_following_for_userHandler(cfg *config.APIConfig) func(ctx contex if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Users_list_following_for_userHandler(cfg *config.APIConfig) func(ctx contex return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Simple_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_gpg_keys_for_authenticated_user.go b/MCP/go/tools/users/users_list_gpg_keys_for_authenticated_user.go index 28b5a21..64b97a5 100644 --- a/MCP/go/tools/users/users_list_gpg_keys_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_gpg_keys_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_gpg_keys_for_authenticated_userHandler(cfg *config.APIConfig) fu if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_gpg_keys_for_authenticated_userHandler(cfg *config.APIConfig) fu if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_gpg_keys_for_authenticated_userHandler(cfg *config.APIConfig) fu return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Gpg_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_gpg_keys_for_user.go b/MCP/go/tools/users/users_list_gpg_keys_for_user.go index ca09cc9..272173b 100644 --- a/MCP/go/tools/users/users_list_gpg_keys_for_user.go +++ b/MCP/go/tools/users/users_list_gpg_keys_for_user.go @@ -34,34 +34,6 @@ func Users_list_gpg_keys_for_userHandler(cfg *config.APIConfig) func(ctx context if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_list_gpg_keys_for_userHandler(cfg *config.APIConfig) func(ctx context if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Users_list_gpg_keys_for_userHandler(cfg *config.APIConfig) func(ctx context return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Gpg_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_public_emails_for_authenticated_user.go b/MCP/go/tools/users/users_list_public_emails_for_authenticated_user.go index bf63976..135e007 100644 --- a/MCP/go/tools/users/users_list_public_emails_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_public_emails_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_public_emails_for_authenticated_userHandler(cfg *config.APIConfi if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_public_emails_for_authenticated_userHandler(cfg *config.APIConfi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_public_emails_for_authenticated_userHandler(cfg *config.APIConfi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Email + var result []models.Email if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_public_keys_for_user.go b/MCP/go/tools/users/users_list_public_keys_for_user.go index 48281a8..2b26cb7 100644 --- a/MCP/go/tools/users/users_list_public_keys_for_user.go +++ b/MCP/go/tools/users/users_list_public_keys_for_user.go @@ -34,34 +34,6 @@ func Users_list_public_keys_for_userHandler(cfg *config.APIConfig) func(ctx cont if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_list_public_keys_for_userHandler(cfg *config.APIConfig) func(ctx cont if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Users_list_public_keys_for_userHandler(cfg *config.APIConfig) func(ctx cont return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Key_simple if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_public_ssh_keys_for_authenticated_user.go b/MCP/go/tools/users/users_list_public_ssh_keys_for_authenticated_user.go index 165c992..7769f93 100644 --- a/MCP/go/tools/users/users_list_public_ssh_keys_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_public_ssh_keys_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_public_ssh_keys_for_authenticated_userHandler(cfg *config.APICon if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_public_ssh_keys_for_authenticated_userHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_public_ssh_keys_for_authenticated_userHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Key + var result []models.Key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_social_accounts_for_authenticated_user.go b/MCP/go/tools/users/users_list_social_accounts_for_authenticated_user.go index 5b40356..fdd8934 100644 --- a/MCP/go/tools/users/users_list_social_accounts_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_social_accounts_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_social_accounts_for_authenticated_userHandler(cfg *config.APICon if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_social_accounts_for_authenticated_userHandler(cfg *config.APICon if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_social_accounts_for_authenticated_userHandler(cfg *config.APICon return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Social_account if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_social_accounts_for_user.go b/MCP/go/tools/users/users_list_social_accounts_for_user.go index adc269a..20bd41f 100644 --- a/MCP/go/tools/users/users_list_social_accounts_for_user.go +++ b/MCP/go/tools/users/users_list_social_accounts_for_user.go @@ -34,34 +34,6 @@ func Users_list_social_accounts_for_userHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_list_social_accounts_for_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Users_list_social_accounts_for_userHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Social_account if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_ssh_signing_keys_for_authenticated_user.go b/MCP/go/tools/users/users_list_ssh_signing_keys_for_authenticated_user.go index 3e718ea..988de70 100644 --- a/MCP/go/tools/users/users_list_ssh_signing_keys_for_authenticated_user.go +++ b/MCP/go/tools/users/users_list_ssh_signing_keys_for_authenticated_user.go @@ -26,34 +26,6 @@ func Users_list_ssh_signing_keys_for_authenticated_userHandler(cfg *config.APICo if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -63,17 +35,20 @@ func Users_list_ssh_signing_keys_for_authenticated_userHandler(cfg *config.APICo if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -91,7 +66,7 @@ func Users_list_ssh_signing_keys_for_authenticated_userHandler(cfg *config.APICo return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Ssh_signing_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_list_ssh_signing_keys_for_user.go b/MCP/go/tools/users/users_list_ssh_signing_keys_for_user.go index 5d5acf7..3e30a93 100644 --- a/MCP/go/tools/users/users_list_ssh_signing_keys_for_user.go +++ b/MCP/go/tools/users/users_list_ssh_signing_keys_for_user.go @@ -34,34 +34,6 @@ func Users_list_ssh_signing_keys_for_userHandler(cfg *config.APIConfig) func(ctx if val, ok := args["page"]; ok { queryParams = append(queryParams, fmt.Sprintf("page=%v", val)) } - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } queryString := "" if len(queryParams) > 0 { queryString = "?" + strings.Join(queryParams, "&") @@ -71,17 +43,20 @@ func Users_list_ssh_signing_keys_for_userHandler(cfg *config.APIConfig) func(ctx if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -99,7 +74,7 @@ func Users_list_ssh_signing_keys_for_userHandler(cfg *config.APIConfig) func(ctx return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []GeneratedType + var result []models.GeneratedType_Ssh_signing_key if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_set_primary_email_visibility_for_authenticated_user.go b/MCP/go/tools/users/users_set_primary_email_visibility_for_authenticated_user.go index 09852c2..af2fd40 100644 --- a/MCP/go/tools/users/users_set_primary_email_visibility_for_authenticated_user.go +++ b/MCP/go/tools/users/users_set_primary_email_visibility_for_authenticated_user.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_set_primary_email_visibility_for_authenticated_userHandler(cfg *confi if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_set_primary_email_visibility_for_authenticated_userHandler(cfg *confi if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user/email/visibility%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user/email/visibility", cfg.BaseURL) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Users_set_primary_email_visibility_for_authenticated_userHandler(cfg *confi return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result []Email + var result []models.Email if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil diff --git a/MCP/go/tools/users/users_unblock.go b/MCP/go/tools/users/users_unblock.go index da24515..4c0cd59 100644 --- a/MCP/go/tools/users/users_unblock.go +++ b/MCP/go/tools/users/users_unblock.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_unblockHandler(cfg *config.APIConfig) func(ctx context.Context, reque if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/blocks/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/user/blocks/%s", cfg.BaseURL, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_unfollow.go b/MCP/go/tools/users/users_unfollow.go index ced710f..e1058f0 100644 --- a/MCP/go/tools/users/users_unfollow.go +++ b/MCP/go/tools/users/users_unfollow.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "github.com/github-v3-rest-api/mcp-server/config" "github.com/github-v3-rest-api/mcp-server/models" @@ -27,55 +26,25 @@ func Users_unfollowHandler(cfg *config.APIConfig) func(ctx context.Context, requ if !ok { return mcp.NewToolResultError("Invalid path parameter: username"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } - url := fmt.Sprintf("%s/user/following/%s%s", cfg.BaseURL, username, queryString) + url := fmt.Sprintf("%s/user/following/%s", cfg.BaseURL, username) req, err := http.NewRequest("DELETE", url, nil) if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) diff --git a/MCP/go/tools/users/users_update_authenticated.go b/MCP/go/tools/users/users_update_authenticated.go index 6f24ddb..6a0f249 100644 --- a/MCP/go/tools/users/users_update_authenticated.go +++ b/MCP/go/tools/users/users_update_authenticated.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "net/http" - "strings" "bytes" "github.com/github-v3-rest-api/mcp-server/config" @@ -20,39 +19,6 @@ func Users_update_authenticatedHandler(cfg *config.APIConfig) func(ctx context.C if !ok { return mcp.NewToolResultError("Invalid arguments object"), nil } - queryParams := make([]string, 0) - // Handle multiple authentication parameters - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("key=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_after=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("last_used_before=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("owner=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("permission=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("repository=%s", cfg.BearerToken)) - } - if cfg.APIKey != "" { - queryParams = append(queryParams, fmt.Sprintf("secret_type=%s", cfg.APIKey)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("sort=%s", cfg.BearerToken)) - } - if cfg.BearerToken != "" { - queryParams = append(queryParams, fmt.Sprintf("token_id=%s", cfg.BearerToken)) - } - queryString := "" - if len(queryParams) > 0 { - queryString = "?" + strings.Join(queryParams, "&") - } // Create properly typed request body using the generated schema var requestBody map[string]interface{} @@ -69,23 +35,26 @@ func Users_update_authenticatedHandler(cfg *config.APIConfig) func(ctx context.C if err != nil { return mcp.NewToolResultErrorFromErr("Failed to encode request body", err), nil } - url := fmt.Sprintf("%s/user%s", cfg.BaseURL, queryString) + url := fmt.Sprintf("%s/user", cfg.BaseURL) req, err := http.NewRequest("PATCH", url, bytes.NewBuffer(bodyBytes)) req.Header.Set("Content-Type", "application/json") if err != nil { return mcp.NewToolResultErrorFromErr("Failed to create request", err), nil } - // Set authentication based on auth type - // Handle multiple authentication parameters - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string - // API key already added to query string + // No specific authentication scheme defined - add fallback authentication + if cfg.BearerToken != "" { + req.Header.Set("Authorization", "Bearer "+cfg.BearerToken) + } else if cfg.APIKey != "" { + req.Header.Set("Authorization", "Bearer "+cfg.APIKey) + } else if cfg.BasicAuth != "" { + req.Header.Set("Authorization", "Basic "+cfg.BasicAuth) + } + // Note: If no auth tokens provided, requests will be made without authentication + + // Add custom headers if provided + + // Set client identification headers + req.Header.Set("X-Request-Source", "Codeglide-MCP-generator") req.Header.Set("Accept", "application/json") resp, err := http.DefaultClient.Do(req) @@ -103,7 +72,7 @@ func Users_update_authenticatedHandler(cfg *config.APIConfig) func(ctx context.C return mcp.NewToolResultError(fmt.Sprintf("API error: %s", body)), nil } // Use properly typed response - var result models.GeneratedType + var result models.GeneratedType_Private_user if err := json.Unmarshal(body, &result); err != nil { // Fallback to raw text if unmarshaling fails return mcp.NewToolResultText(string(body)), nil @@ -121,6 +90,7 @@ func Users_update_authenticatedHandler(cfg *config.APIConfig) func(ctx context.C func CreateUsers_update_authenticatedTool(cfg *config.APIConfig) models.Tool { tool := mcp.NewTool("patch_user", mcp.WithDescription("Update the authenticated user"), + mcp.WithString("twitter_username", mcp.Description("Input parameter: The new Twitter username of the user.")), mcp.WithString("bio", mcp.Description("Input parameter: The new short biography of the user.")), mcp.WithString("blog", mcp.Description("Input parameter: The new blog URL of the user.")), mcp.WithString("company", mcp.Description("Input parameter: The new company of the user.")), @@ -128,7 +98,6 @@ func CreateUsers_update_authenticatedTool(cfg *config.APIConfig) models.Tool { mcp.WithBoolean("hireable", mcp.Description("Input parameter: The new hiring availability of the user.")), mcp.WithString("location", mcp.Description("Input parameter: The new location of the user.")), mcp.WithString("name", mcp.Description("Input parameter: The new name of the user.")), - mcp.WithString("twitter_username", mcp.Description("Input parameter: The new Twitter username of the user.")), ) return models.Tool{