Class: Files::AiAssistantPersonality

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/ai_assistant_personality.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ AiAssistantPersonality

Returns a new instance of AiAssistantPersonality.



7
8
9
10
# File 'lib/files.com/models/ai_assistant_personality.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/ai_assistant_personality.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/ai_assistant_personality.rb', line 5

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



126
127
128
# File 'lib/files.com/models/ai_assistant_personality.rb', line 126

def self.all(params = {}, options = {})
  list(params, options)
end

.create(params = {}, options = {}) ⇒ Object

Parameters:

apply_to_all_workspaces - boolean - If true, this default-workspace personality can apply to users in all workspaces.
system_prompt (required) - string - System prompt injected into the in-app AI Assistant.
use_by_default - boolean - Whether this personality is the default personality for the Workspace.
workspace_id - int64 - Workspace ID. `0` means the default workspace.


151
152
153
154
155
156
157
158
# File 'lib/files.com/models/ai_assistant_personality.rb', line 151

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: system_prompt must be an String") if params[:system_prompt] and !params[:system_prompt].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: system_prompt") unless params[:system_prompt]

  response, options = Api.send_request("/ai_assistant_personalities", :post, params, options)
  AiAssistantPersonality.new(response.data, options)
end

.delete(id, params = {}, options = {}) ⇒ Object



177
178
179
180
181
182
183
184
185
# File 'lib/files.com/models/ai_assistant_personality.rb', line 177

def self.delete(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/ai_assistant_personalities/#{params[:id]}", :delete, params, options)
  nil
end

.destroy(id, params = {}, options = {}) ⇒ Object



187
188
189
190
# File 'lib/files.com/models/ai_assistant_personality.rb', line 187

def self.destroy(id, params = {}, options = {})
  delete(id, params, options)
  nil
end

.find(id, params = {}, options = {}) ⇒ Object

Parameters:

id (required) - int64 - Ai Assistant Personality ID.


132
133
134
135
136
137
138
139
140
# File 'lib/files.com/models/ai_assistant_personality.rb', line 132

def self.find(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :get, params, options)
  AiAssistantPersonality.new(response.data, options)
end

.get(id, params = {}, options = {}) ⇒ Object



142
143
144
# File 'lib/files.com/models/ai_assistant_personality.rb', line 142

def self.get(id, params = {}, options = {})
  find(id, params, options)
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).
sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id` and `id`.
filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`.


115
116
117
118
119
120
121
122
123
124
# File 'lib/files.com/models/ai_assistant_personality.rb', line 115

def self.list(params = {}, options = {})
  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: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)

  List.new(AiAssistantPersonality, params) do
    Api.send_request("/ai_assistant_personalities", :get, params, options)
  end
end

.update(id, params = {}, options = {}) ⇒ Object

Parameters:

apply_to_all_workspaces - boolean - If true, this default-workspace personality can apply to users in all workspaces.
system_prompt - string - System prompt injected into the in-app AI Assistant.
use_by_default - boolean - Whether this personality is the default personality for the Workspace.
workspace_id - int64 - Workspace ID. `0` means the default workspace.


165
166
167
168
169
170
171
172
173
174
175
# File 'lib/files.com/models/ai_assistant_personality.rb', line 165

def self.update(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: system_prompt must be an String") if params[:system_prompt] and !params[:system_prompt].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :patch, params, options)
  AiAssistantPersonality.new(response.data, options)
end

Instance Method Details

#apply_to_all_workspacesObject

boolean - If true, this default-workspace personality can apply to users in all workspaces.



49
50
51
# File 'lib/files.com/models/ai_assistant_personality.rb', line 49

def apply_to_all_workspaces
  @attributes[:apply_to_all_workspaces]
end

#apply_to_all_workspaces=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/ai_assistant_personality.rb', line 53

def apply_to_all_workspaces=(value)
  @attributes[:apply_to_all_workspaces] = value
end

#created_atObject

date-time - Creation time.



58
59
60
# File 'lib/files.com/models/ai_assistant_personality.rb', line 58

def created_at
  @attributes[:created_at]
end

#delete(params = {}) ⇒ Object



84
85
86
87
88
89
90
91
92
# File 'lib/files.com/models/ai_assistant_personality.rb', line 84

def delete(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/ai_assistant_personalities/#{@attributes[:id]}", :delete, params, @options)
end

#destroy(params = {}) ⇒ Object



94
95
96
97
# File 'lib/files.com/models/ai_assistant_personality.rb', line 94

def destroy(params = {})
  delete(params)
  nil
end

#idObject

int64 - AI Assistant Personality ID.



13
14
15
# File 'lib/files.com/models/ai_assistant_personality.rb', line 13

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/ai_assistant_personality.rb', line 17

def id=(value)
  @attributes[:id] = value
end

#saveObject



99
100
101
102
103
104
105
106
107
108
# File 'lib/files.com/models/ai_assistant_personality.rb', line 99

def save
  if @attributes[:id]
    new_obj = update(@attributes)
  else
    new_obj = AiAssistantPersonality.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#system_promptObject

string - System prompt injected into the in-app AI Assistant.



31
32
33
# File 'lib/files.com/models/ai_assistant_personality.rb', line 31

def system_prompt
  @attributes[:system_prompt]
end

#system_prompt=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/ai_assistant_personality.rb', line 35

def system_prompt=(value)
  @attributes[:system_prompt] = value
end

#update(params = {}) ⇒ Object

Parameters:

apply_to_all_workspaces - boolean - If true, this default-workspace personality can apply to users in all workspaces.
system_prompt - string - System prompt injected into the in-app AI Assistant.
use_by_default - boolean - Whether this personality is the default personality for the Workspace.
workspace_id - int64 - Workspace ID. `0` means the default workspace.


72
73
74
75
76
77
78
79
80
81
82
# File 'lib/files.com/models/ai_assistant_personality.rb', line 72

def update(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: system_prompt must be an String") if params[:system_prompt] and !params[:system_prompt].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/ai_assistant_personalities/#{@attributes[:id]}", :patch, params, @options)
end

#updated_atObject

date-time - Last update time.



63
64
65
# File 'lib/files.com/models/ai_assistant_personality.rb', line 63

def updated_at
  @attributes[:updated_at]
end

#use_by_defaultObject

boolean - Whether this personality is the default personality for the Workspace.



40
41
42
# File 'lib/files.com/models/ai_assistant_personality.rb', line 40

def use_by_default
  @attributes[:use_by_default]
end

#use_by_default=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/ai_assistant_personality.rb', line 44

def use_by_default=(value)
  @attributes[:use_by_default] = value
end

#workspace_idObject

int64 - Workspace ID. 0 means the default workspace.



22
23
24
# File 'lib/files.com/models/ai_assistant_personality.rb', line 22

def workspace_id
  @attributes[:workspace_id]
end

#workspace_id=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/ai_assistant_personality.rb', line 26

def workspace_id=(value)
  @attributes[:workspace_id] = value
end