Merge pull request #149 from bucolucas/enhance-project-board-responses

Enhance Project Board Responses
This commit is contained in:
2024-08-20 22:53:51 -05:00
committed by GitHub
+58 -10
View File
@@ -948,11 +948,21 @@ class GitHubTool(BaseTool):
project = response.json() project = response.json()
success_message = f"Project board '{name}' created successfully." success_message = f"Project board '{name}' created successfully."
self.logger.info(success_message) self.logger.info(success_message)
return success_message return {
"status": "success",
"status_code": response.status_code,
"message": success_message,
"data": project
}
else: else:
error_message = f"Error creating project board: {response.status_code}" error_message = f"Error creating project board: {response.status_code}"
self.logger.error(error_message) self.logger.error(error_message)
return error_message return {
"status": "error",
"status_code": response.status_code,
"message": error_message,
"response": response.text
}
@metrics.measure @metrics.measure
def _create_project_column(self, project_id, column_name): def _create_project_column(self, project_id, column_name):
@@ -963,11 +973,21 @@ class GitHubTool(BaseTool):
column = response.json() column = response.json()
success_message = f"Column '{column_name}' created successfully in project {project_id}." success_message = f"Column '{column_name}' created successfully in project {project_id}."
self.logger.info(success_message) self.logger.info(success_message)
return success_message return {
"status": "success",
"status_code": response.status_code,
"message": success_message,
"data": column
}
else: else:
error_message = f"Error creating project column: {response.status_code}" error_message = f"Error creating project column: {response.status_code}"
self.logger.error(error_message) self.logger.error(error_message)
return error_message return {
"status": "error",
"status_code": response.status_code,
"message": error_message,
"response": response.text
}
@metrics.measure @metrics.measure
def _create_project_card(self, column_id, note): def _create_project_card(self, column_id, note):
@@ -978,11 +998,21 @@ class GitHubTool(BaseTool):
card = response.json() card = response.json()
success_message = f"Card created successfully in column {column_id}." success_message = f"Card created successfully in column {column_id}."
self.logger.info(success_message) self.logger.info(success_message)
return success_message return {
"status": "success",
"status_code": response.status_code,
"message": success_message,
"data": card
}
else: else:
error_message = f"Error creating project card: {response.status_code}" error_message = f"Error creating project card: {response.status_code}"
self.logger.error(error_message) self.logger.error(error_message)
return error_message return {
"status": "error",
"status_code": response.status_code,
"message": error_message,
"response": response.text
}
@metrics.measure @metrics.measure
def _move_project_card(self, card_id, position, column_id): def _move_project_card(self, card_id, position, column_id):
@@ -992,11 +1022,20 @@ class GitHubTool(BaseTool):
if response.status_code == 201: if response.status_code == 201:
success_message = f"Card {card_id} moved successfully." success_message = f"Card {card_id} moved successfully."
self.logger.info(success_message) self.logger.info(success_message)
return success_message return {
"status": "success",
"status_code": response.status_code,
"message": success_message
}
else: else:
error_message = f"Error moving project card: {response.status_code}" error_message = f"Error moving project card: {response.status_code}"
self.logger.error(error_message) self.logger.error(error_message)
return error_message return {
"status": "error",
"status_code": response.status_code,
"message": error_message,
"response": response.text
}
@metrics.measure @metrics.measure
def _link_issue_to_project_card(self, card_id, content_id, content_type): def _link_issue_to_project_card(self, card_id, content_id, content_type):
@@ -1006,8 +1045,17 @@ class GitHubTool(BaseTool):
if response.status_code == 200: if response.status_code == 200:
success_message = f"Issue/PR linked to card {card_id} successfully." success_message = f"Issue/PR linked to card {card_id} successfully."
self.logger.info(success_message) self.logger.info(success_message)
return success_message return {
"status": "success",
"status_code": response.status_code,
"message": success_message
}
else: else:
error_message = f"Error linking issue/PR to project card: {response.status_code}" error_message = f"Error linking issue/PR to project card: {response.status_code}"
self.logger.error(error_message) self.logger.error(error_message)
return error_message return {
"status": "error",
"status_code": response.status_code,
"message": error_message,
"response": response.text
}