fetch_hive 0.2.5 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -5
  3. data/lib/fetch_hive/client.rb +139 -13
  4. data/lib/fetch_hive/generated/api/agent_chat_messages_api.rb +97 -0
  5. data/lib/fetch_hive/generated/api/agent_chats_api.rb +413 -0
  6. data/lib/fetch_hive/generated/api/agents_api.rb +359 -4
  7. data/lib/fetch_hive/generated/api/assets_api.rb +153 -0
  8. data/lib/fetch_hive/generated/api/hive_agents_api.rb +90 -0
  9. data/lib/fetch_hive/generated/api/knowledge_base_items_api.rb +482 -0
  10. data/lib/fetch_hive/generated/api/knowledge_bases_api.rb +457 -0
  11. data/lib/fetch_hive/generated/api/models_api.rb +79 -0
  12. data/lib/fetch_hive/generated/api/prompts_api.rb +3 -3
  13. data/lib/fetch_hive/generated/api/requests_api.rb +85 -0
  14. data/lib/fetch_hive/generated/api/search_services_api.rb +147 -0
  15. data/lib/fetch_hive/generated/api/workflows_api.rb +2 -2
  16. data/lib/fetch_hive/generated/api_client.rb +2 -2
  17. data/lib/fetch_hive/generated/api_error.rb +2 -2
  18. data/lib/fetch_hive/generated/api_model_base.rb +2 -2
  19. data/lib/fetch_hive/generated/configuration.rb +2 -2
  20. data/lib/fetch_hive/generated/models/agent_attachment.rb +104 -0
  21. data/lib/fetch_hive/generated/models/agent_attachment_one_of.rb +191 -0
  22. data/lib/fetch_hive/generated/models/agent_message.rb +11 -11
  23. data/lib/fetch_hive/generated/models/asset_object.rb +350 -0
  24. data/lib/fetch_hive/generated/models/asset_object_transcription.rb +212 -0
  25. data/lib/fetch_hive/generated/models/async_config.rb +2 -2
  26. data/lib/fetch_hive/generated/models/delete_public_workspaces_agents200_response.rb +164 -0
  27. data/lib/fetch_hive/generated/models/delete_public_workspaces_agents_chats200_response.rb +164 -0
  28. data/lib/fetch_hive/generated/models/delete_public_workspaces_agents_chats404_response.rb +164 -0
  29. data/lib/fetch_hive/generated/models/delete_public_workspaces_knowledge_bases200_response.rb +164 -0
  30. data/lib/fetch_hive/generated/models/delete_public_workspaces_knowledge_bases_items200_response.rb +164 -0
  31. data/lib/fetch_hive/generated/models/error_response.rb +23 -17
  32. data/lib/fetch_hive/generated/models/generated_artifact.rb +236 -0
  33. data/lib/fetch_hive/generated/models/get_public_models200_response_inner.rb +474 -0
  34. data/lib/fetch_hive/generated/models/get_public_requests200_response.rb +319 -0
  35. data/lib/fetch_hive/generated/models/get_public_requests404_response.rb +164 -0
  36. data/lib/fetch_hive/generated/models/get_public_search_services_countries200_response.rb +166 -0
  37. data/lib/fetch_hive/generated/models/get_public_search_services_countries200_response_services_inner.rb +294 -0
  38. data/lib/fetch_hive/generated/models/get_public_search_services_countries200_response_services_inner_countries_inner.rb +216 -0
  39. data/lib/fetch_hive/generated/models/get_public_search_services_countries2404_response.rb +175 -0
  40. data/lib/fetch_hive/generated/models/get_public_workspaces_agents200_response.rb +164 -0
  41. data/lib/fetch_hive/generated/models/get_public_workspaces_agents2200_response.rb +166 -0
  42. data/lib/fetch_hive/generated/models/get_public_workspaces_agents_chats200_response.rb +164 -0
  43. data/lib/fetch_hive/generated/models/get_public_workspaces_agents_chats_messages200_response.rb +166 -0
  44. data/lib/fetch_hive/generated/models/get_public_workspaces_agents_chats_messages200_response_messages_inner.rb +276 -0
  45. data/lib/fetch_hive/generated/models/get_public_workspaces_agents_chats_messages422_response.rb +164 -0
  46. data/lib/fetch_hive/generated/models/get_public_workspaces_assets200_response.rb +166 -0
  47. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases200_response.rb +166 -0
  48. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases2200_response.rb +164 -0
  49. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases2422_response.rb +164 -0
  50. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases_items200_response.rb +166 -0
  51. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases_items200_response_knowledge_base_items_inner.rb +294 -0
  52. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases_items2200_response.rb +164 -0
  53. data/lib/fetch_hive/generated/models/get_public_workspaces_knowledge_bases_items2422_response.rb +164 -0
  54. data/lib/fetch_hive/generated/models/hive_agent_async_config.rb +192 -0
  55. data/lib/fetch_hive/generated/models/hive_agent_sources.rb +187 -0
  56. data/lib/fetch_hive/generated/models/invoke_agent_request.rb +92 -11
  57. data/lib/fetch_hive/generated/models/invoke_agent_response.rb +18 -6
  58. data/lib/fetch_hive/generated/models/invoke_hive_agent_request.rb +239 -0
  59. data/lib/fetch_hive/generated/models/invoke_hive_agent_response.rb +213 -0
  60. data/lib/fetch_hive/generated/models/invoke_prompt_request.rb +2 -2
  61. data/lib/fetch_hive/generated/models/invoke_prompt_response.rb +2 -2
  62. data/lib/fetch_hive/generated/models/invoke_workflow_async_response.rb +2 -2
  63. data/lib/fetch_hive/generated/models/invoke_workflow_request.rb +2 -2
  64. data/lib/fetch_hive/generated/models/invoke_workflow_response.rb +2 -2
  65. data/lib/fetch_hive/generated/models/knowledge_base_object.rb +470 -0
  66. data/lib/fetch_hive/generated/models/metadata_value.rb +2 -2
  67. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents200_response.rb +190 -0
  68. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents_chats200_response.rb +190 -0
  69. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents_chats_clear_messages200_response.rb +190 -0
  70. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents_chats_request.rb +164 -0
  71. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents_chats_request_chat.rb +147 -0
  72. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents_request.rb +164 -0
  73. data/lib/fetch_hive/generated/models/patch_public_workspaces_agents_request_agent.rb +304 -0
  74. data/lib/fetch_hive/generated/models/patch_public_workspaces_knowledge_bases200_response.rb +190 -0
  75. data/lib/fetch_hive/generated/models/patch_public_workspaces_knowledge_bases_items200_response.rb +190 -0
  76. data/lib/fetch_hive/generated/models/patch_public_workspaces_knowledge_bases_items_request.rb +164 -0
  77. data/lib/fetch_hive/generated/models/patch_public_workspaces_knowledge_bases_items_request_knowledge_base_item.rb +265 -0
  78. data/lib/fetch_hive/generated/models/patch_public_workspaces_knowledge_bases_request.rb +147 -0
  79. data/lib/fetch_hive/generated/models/patch_public_workspaces_knowledge_bases_request_knowledge_base.rb +217 -0
  80. data/lib/fetch_hive/generated/models/post_public_workspaces_agents200_response.rb +190 -0
  81. data/lib/fetch_hive/generated/models/post_public_workspaces_agents422_response.rb +164 -0
  82. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_chats200_response.rb +190 -0
  83. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_chats200_response_chat.rb +305 -0
  84. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_chats422_response.rb +175 -0
  85. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_chats_request.rb +164 -0
  86. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_chats_request_chat.rb +164 -0
  87. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_request.rb +164 -0
  88. data/lib/fetch_hive/generated/models/post_public_workspaces_agents_request_agent.rb +252 -0
  89. data/lib/fetch_hive/generated/models/post_public_workspaces_assets200_response.rb +190 -0
  90. data/lib/fetch_hive/generated/models/post_public_workspaces_assets422_response.rb +216 -0
  91. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases200_response.rb +190 -0
  92. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_items200_response.rb +190 -0
  93. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_items422_response.rb +158 -0
  94. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_items_regenerate200_response.rb +190 -0
  95. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_items_request.rb +164 -0
  96. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_items_request_knowledge_base_item.rb +322 -0
  97. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_request.rb +164 -0
  98. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_request_knowledge_base.rb +234 -0
  99. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_search200_response.rb +190 -0
  100. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_search422_response.rb +164 -0
  101. data/lib/fetch_hive/generated/models/post_public_workspaces_knowledge_bases_search_request.rb +302 -0
  102. data/lib/fetch_hive/generated/models/sse_chunk.rb +13 -4
  103. data/lib/fetch_hive/generated/models/token_usage.rb +2 -2
  104. data/lib/fetch_hive/generated/models/tool_invocation.rb +2 -2
  105. data/lib/fetch_hive/generated/version.rb +2 -2
  106. metadata +83 -3
@@ -0,0 +1,147 @@
1
+ =begin
2
+ #Fetch Hive Public API
3
+
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
+
6
+ The version of the OpenAPI document: 0.2.8
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module FetchHive::Generated
16
+ class SearchServicesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List public search-service country catalogs
23
+ # Returns the country catalogs used by public search workflow services. This endpoint is unauthenticated and exposes the value each service expects for location/country configuration.
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [GetPublicSearchServicesCountries200Response]
26
+ def get_public_search_services_countries(opts = {})
27
+ data, _status_code, _headers = get_public_search_services_countries_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # List public search-service country catalogs
32
+ # Returns the country catalogs used by public search workflow services. This endpoint is unauthenticated and exposes the value each service expects for location/country configuration.
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(GetPublicSearchServicesCountries200Response, Integer, Hash)>] GetPublicSearchServicesCountries200Response data, response status code and response headers
35
+ def get_public_search_services_countries_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: SearchServicesApi.get_public_search_services_countries ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/public/search_services/countries'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'GetPublicSearchServicesCountries200Response'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || []
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"SearchServicesApi.get_public_search_services_countries",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: SearchServicesApi#get_public_search_services_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+
79
+ # Retrieve public search-service country catalog
80
+ # Returns the country catalog for one supported search workflow service. Use each country object's `value` field when configuring that service.
81
+ # @param service [String] Search workflow service key.
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [GetPublicSearchServicesCountries200ResponseServicesInner]
84
+ def get_public_search_services_countries2(service, opts = {})
85
+ data, _status_code, _headers = get_public_search_services_countries2_with_http_info(service, opts)
86
+ data
87
+ end
88
+
89
+ # Retrieve public search-service country catalog
90
+ # Returns the country catalog for one supported search workflow service. Use each country object&#39;s &#x60;value&#x60; field when configuring that service.
91
+ # @param service [String] Search workflow service key.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [Array<(GetPublicSearchServicesCountries200ResponseServicesInner, Integer, Hash)>] GetPublicSearchServicesCountries200ResponseServicesInner data, response status code and response headers
94
+ def get_public_search_services_countries2_with_http_info(service, opts = {})
95
+ if @api_client.config.debugging
96
+ @api_client.config.logger.debug 'Calling API: SearchServicesApi.get_public_search_services_countries2 ...'
97
+ end
98
+ # verify the required parameter 'service' is set
99
+ if @api_client.config.client_side_validation && service.nil?
100
+ fail ArgumentError, "Missing the required parameter 'service' when calling SearchServicesApi.get_public_search_services_countries2"
101
+ end
102
+ # verify enum value
103
+ allowable_values = ["google_search", "google_news", "google_ai_mode", "google_ai_overview", "bing_search"]
104
+ if @api_client.config.client_side_validation && !allowable_values.include?(service)
105
+ fail ArgumentError, "invalid value for \"service\", must be one of #{allowable_values}"
106
+ end
107
+ # resource path
108
+ local_var_path = '/public/search_services/{service}/countries'.sub('{service}', CGI.escape(service.to_s))
109
+
110
+ # query parameters
111
+ query_params = opts[:query_params] || {}
112
+
113
+ # header parameters
114
+ header_params = opts[:header_params] || {}
115
+ # HTTP header 'Accept' (if needed)
116
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
117
+
118
+ # form parameters
119
+ form_params = opts[:form_params] || {}
120
+
121
+ # http body (model)
122
+ post_body = opts[:debug_body]
123
+
124
+ # return_type
125
+ return_type = opts[:debug_return_type] || 'GetPublicSearchServicesCountries200ResponseServicesInner'
126
+
127
+ # auth_names
128
+ auth_names = opts[:debug_auth_names] || []
129
+
130
+ new_options = opts.merge(
131
+ :operation => :"SearchServicesApi.get_public_search_services_countries2",
132
+ :header_params => header_params,
133
+ :query_params => query_params,
134
+ :form_params => form_params,
135
+ :body => post_body,
136
+ :auth_names => auth_names,
137
+ :return_type => return_type
138
+ )
139
+
140
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
141
+ if @api_client.config.debugging
142
+ @api_client.config.logger.debug "API called: SearchServicesApi#get_public_search_services_countries2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
143
+ end
144
+ return data, status_code, headers
145
+ end
146
+ end
147
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Fetch Hive Public API
3
3
 
4
- #The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
5
 
6
- The version of the OpenAPI document: 0.2.5
6
+ The version of the OpenAPI document: 0.2.8
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Fetch Hive Public API
3
3
 
4
- #The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
5
 
6
- The version of the OpenAPI document: 0.2.5
6
+ The version of the OpenAPI document: 0.2.8
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Fetch Hive Public API
3
3
 
4
- #The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
5
 
6
- The version of the OpenAPI document: 0.2.5
6
+ The version of the OpenAPI document: 0.2.8
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Fetch Hive Public API
3
3
 
4
- #The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
5
 
6
- The version of the OpenAPI document: 0.2.5
6
+ The version of the OpenAPI document: 0.2.8
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Fetch Hive Public API
3
3
 
4
- #The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
5
 
6
- The version of the OpenAPI document: 0.2.5
6
+ The version of the OpenAPI document: 0.2.8
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -0,0 +1,104 @@
1
+ =begin
2
+ #Fetch Hive Public API
3
+
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
+
6
+ The version of the OpenAPI document: 0.2.8
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FetchHive::Generated
17
+ module AgentAttachment
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'AgentAttachmentOneOf',
23
+ :'String'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_one_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = FetchHive::Generated.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1,191 @@
1
+ =begin
2
+ #Fetch Hive Public API
3
+
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
+
6
+ The version of the OpenAPI document: 0.2.8
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FetchHive::Generated
17
+ class AgentAttachmentOneOf < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :file_url
21
+
22
+ attr_accessor :file_name
23
+
24
+ attr_accessor :file_type
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'id' => :'id',
30
+ :'file_url' => :'file_url',
31
+ :'file_name' => :'file_name',
32
+ :'file_type' => :'file_type'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'id' => :'String',
50
+ :'file_url' => :'String',
51
+ :'file_name' => :'String',
52
+ :'file_type' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FetchHive::Generated::AgentAttachmentOneOf` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ acceptable_attribute_map = self.class.acceptable_attribute_map
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!acceptable_attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FetchHive::Generated::AgentAttachmentOneOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
80
+ end
81
+
82
+ if attributes.key?(:'file_url')
83
+ self.file_url = attributes[:'file_url']
84
+ else
85
+ self.file_url = nil
86
+ end
87
+
88
+ if attributes.key?(:'file_name')
89
+ self.file_name = attributes[:'file_name']
90
+ end
91
+
92
+ if attributes.key?(:'file_type')
93
+ self.file_type = attributes[:'file_type']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @file_url.nil?
103
+ invalid_properties.push('invalid value for "file_url", file_url cannot be nil.')
104
+ end
105
+
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ return false if @file_url.nil?
114
+ true
115
+ end
116
+
117
+ # Custom attribute writer method with validation
118
+ # @param [Object] file_url Value to be assigned
119
+ def file_url=(file_url)
120
+ if file_url.nil?
121
+ fail ArgumentError, 'file_url cannot be nil'
122
+ end
123
+
124
+ @file_url = file_url
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ id == o.id &&
133
+ file_url == o.file_url &&
134
+ file_name == o.file_name &&
135
+ file_type == o.file_type
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [id, file_url, file_name, file_type].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ attributes = attributes.transform_keys(&:to_sym)
156
+ transformed_hash = {}
157
+ openapi_types.each_pair do |key, type|
158
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[attribute_map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
165
+ end
166
+ elsif !attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
168
+ end
169
+ end
170
+ new(transformed_hash)
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ end
190
+
191
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #Fetch Hive Public API
3
3
 
4
- #The Fetch Hive public API lets you invoke prompts, workflows, and agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
4
+ #The Fetch Hive public API lets you invoke prompts, workflows, agents, and Hive Agents programmatically using an API token. ## Authentication All requests require a Bearer token in the `Authorization` header: ``` Authorization: Bearer <your-api-token> ``` ## Streaming Pass `\"streaming\": true` in the request body to receive a `text/event-stream` response. Each event is a JSON object sent as `data: <json>\\n\\n`. The stream ends with `data: [DONE]\\n\\n`.
5
5
 
6
- The version of the OpenAPI document: 0.2.5
6
+ The version of the OpenAPI document: 0.2.8
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.22.0
@@ -21,8 +21,8 @@ module FetchHive::Generated
21
21
  # Text content of the message.
22
22
  attr_accessor :content
23
23
 
24
- # HTTPS image URLs attached to this message.
25
- attr_accessor :image_urls
24
+ # Structured external document/image attachments for this historical message.
25
+ attr_accessor :attachments
26
26
 
27
27
  class EnumAttributeValidator
28
28
  attr_reader :datatype
@@ -51,7 +51,7 @@ module FetchHive::Generated
51
51
  {
52
52
  :'role' => :'role',
53
53
  :'content' => :'content',
54
- :'image_urls' => :'image_urls'
54
+ :'attachments' => :'attachments'
55
55
  }
56
56
  end
57
57
 
@@ -70,7 +70,7 @@ module FetchHive::Generated
70
70
  {
71
71
  :'role' => :'String',
72
72
  :'content' => :'String',
73
- :'image_urls' => :'Array<String>'
73
+ :'attachments' => :'Array<AgentAttachment>'
74
74
  }
75
75
  end
76
76
 
@@ -108,9 +108,9 @@ module FetchHive::Generated
108
108
  self.content = nil
109
109
  end
110
110
 
111
- if attributes.key?(:'image_urls')
112
- if (value = attributes[:'image_urls']).is_a?(Array)
113
- self.image_urls = value
111
+ if attributes.key?(:'attachments')
112
+ if (value = attributes[:'attachments']).is_a?(Array)
113
+ self.attachments = value
114
114
  end
115
115
  end
116
116
  end
@@ -169,7 +169,7 @@ module FetchHive::Generated
169
169
  self.class == o.class &&
170
170
  role == o.role &&
171
171
  content == o.content &&
172
- image_urls == o.image_urls
172
+ attachments == o.attachments
173
173
  end
174
174
 
175
175
  # @see the `==` method
@@ -181,7 +181,7 @@ module FetchHive::Generated
181
181
  # Calculates hash code according to all attributes.
182
182
  # @return [Integer] Hash code
183
183
  def hash
184
- [role, content, image_urls].hash
184
+ [role, content, attachments].hash
185
185
  end
186
186
 
187
187
  # Builds the object from hash