Class: Files::ChatSession
- Inherits:
-
Object
- Object
- Files::ChatSession
- Defined in:
- lib/files.com/models/chat_session.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - string - Chat Session ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: cursor - string - Used for pagination.
Instance Method Summary collapse
-
#ai_task_id ⇒ Object
int64 - AI Task ID.
-
#created_at ⇒ Object
date-time - Chat session creation date/time.
-
#id ⇒ Object
string - Chat Session ID.
-
#initialize(attributes = {}, options = {}) ⇒ ChatSession
constructor
A new instance of ChatSession.
-
#last_active_at ⇒ Object
date-time - Most recent chat activity date/time.
-
#messages ⇒ Object
array(object) - Visible conversation messages in this chat session.
-
#user_id ⇒ Object
int64 - User ID.
-
#workspace_id ⇒ Object
int64 - Workspace ID.
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ ChatSession
Returns a new instance of ChatSession.
7 8 9 10 |
# File 'lib/files.com/models/chat_session.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/chat_session.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/chat_session.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
61 62 63 |
# File 'lib/files.com/models/chat_session.rb', line 61 def self.all(params = {}, = {}) list(params, ) end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - string - Chat Session ID.
67 68 69 70 71 72 73 74 75 |
# File 'lib/files.com/models/chat_session.rb', line 67 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an String") if params[:id] and !params[:id].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/chat_sessions/#{params[:id]}", :get, params, ) ChatSession.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
77 78 79 |
# File 'lib/files.com/models/chat_session.rb', line 77 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `ai_task_id`.
51 52 53 54 55 56 57 58 59 |
# File 'lib/files.com/models/chat_session.rb', line 51 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash) List.new(ChatSession, params) do Api.send_request("/chat_sessions", :get, params, ) end end |
Instance Method Details
#ai_task_id ⇒ Object
int64 - AI Task ID. Present when the conversation was started by an AI Task.
23 24 25 |
# File 'lib/files.com/models/chat_session.rb', line 23 def ai_task_id @attributes[:ai_task_id] end |
#created_at ⇒ Object
date-time - Chat session creation date/time.
38 39 40 |
# File 'lib/files.com/models/chat_session.rb', line 38 def created_at @attributes[:created_at] end |
#id ⇒ Object
string - Chat Session ID.
13 14 15 |
# File 'lib/files.com/models/chat_session.rb', line 13 def id @attributes[:id] end |
#last_active_at ⇒ Object
date-time - Most recent chat activity date/time.
33 34 35 |
# File 'lib/files.com/models/chat_session.rb', line 33 def last_active_at @attributes[:last_active_at] end |
#messages ⇒ Object
array(object) - Visible conversation messages in this chat session. For performance reasons, this is not provided when listing chat sessions.
43 44 45 |
# File 'lib/files.com/models/chat_session.rb', line 43 def @attributes[:messages] end |
#user_id ⇒ Object
int64 - User ID.
18 19 20 |
# File 'lib/files.com/models/chat_session.rb', line 18 def user_id @attributes[:user_id] end |
#workspace_id ⇒ Object
int64 - Workspace ID. ‘0` means the default workspace.
28 29 30 |
# File 'lib/files.com/models/chat_session.rb', line 28 def workspace_id @attributes[:workspace_id] end |