github.com/grokify/go-ringcentral-client@v0.3.31/codegen/specs-engagedigital_v3.0.0/conv_doc2query.rb (about)

     1  #!ruby
     2  
     3  require 'multi_json'
     4  
     5  doc = 'name: Team name.
     6  leader_ids[]: List of user id as leaders | array:string
     7  user_ids[]: List of user id as team members. | array:string'
     8  
     9  doc = 'label: Folder’s label (mandatory).
    10  parent_id: ID of the parent folder.
    11  position: position of the folder. | integer
    12  query: query of the folder as described in ​Search API documentation.​\n\nExample: “​active_and_assigned_to_me:true”
    13  render_threads_count: boolean describing display of the number of threads. | boolean
    14  role_restriction[only][]: list of roles allowed to see this folder. This parameter has to be a hash otherwise it will raise a 400 error. The key should be "only". For example: `&role_restriction[only][]=4e5596cdae70f677b5000002` | array:string
    15  team_restriction[only][]: list of teams allowed to see this folder. Same thing as role_restriction: team_restriction parameter has to be a hash with the key "only". | array:string'
    16  
    17  doc = '● name: Source name
    18  ● active: Activate/deactivate the source (Boolean)
    19  ● channel_id: Channel
    20  ● color: Color of the icon (see S​ ource colors​) (Integer)
    21  ● sla_response: Response time (seconds)
    22  ● sla_expired_strategy: SLA expired strategy ("max", "half" or "base")
    23  ● intervention_messages_boost: Priority boost of messages with intervention (Integer)
    24  ● transferred_tasks_boost: Priority boost of transferred tasks (Integer)
    25  ● hidden_from_stats: Hide from statistics (Boolean)
    26  ● default_category_ids[]: Default categories | array:string
    27  ● user_thread_default_category_ids[]: Default categories (agent messages) | array:string
    28  ● default_content_language: Default content language
    29  ● auto_detect_content_language: Auto-detect content language (Boolean)
    30  ● content_archiving: Automatic archiving of old contents (Boolean)
    31  ● content_archiving_period: Archive contents older than (seconds)'
    32  
    33  doc = '● community_id: To filter identities on given community id.
    34  ● identity_group_id: To filter on given group id.
    35  ● user_id: To filter identities on given user id.
    36  ● sort: To change the criteria chosen to sort the identities. The value can be “created_at” or
    37  “updated_at”.
    38  ● foreign_id: To filter identities on given user id
    39  ● uuid: To filter identities on given uuid'
    40  
    41  doc = '● category_ids: User list of category ids (multiple).
    42  ● email: User email (mandatory).
    43  ● enabled: Whether the user is enabled or not (boolean).
    44  ● external_id: User external id.
    45  ● firstname: User firstname (mandatory).
    46  ● gender: User gender ("man" or "woman").
    47  ● identity_ids: User list of identity ids (multiple).
    48  ● lastname: User lastname (mandatory).
    49  ● locale: Language for the user interface.
    50  ● nickname: User nickname.
    51  ● role_id: User role id (mandatory).
    52  ● team_ids: User list of team ids (multiple).
    53  ● timezone: Use the timezone endpoint to get the timezone name (String), default is empty for
    54  domain timezone.
    55  ● spoken_languages: List of locales corresponding to the languages spoken by the user (multiple).'
    56  
    57  doc = '
    58  ● access_help_center
    59  ● access_previous_messages
    60  ● access_pull_mode
    61  ● admin_stamp_answer
    62  ● approve_content
    63  ● assign_intervention
    64  ● author_block_content
    65  ● close_content_thread
    66  ● create_and_destroy_extension
    67  ● create_community
    68  ● create_content_source
    69  ● create_user
    70  ● delay_export_content
    71  ● delete_content_thread
    72  ● impersonate_user
    73  ● invite_user
    74  ● manage_api_access_tokens
    75  ● manage_app_sdk_applications
    76  ● manage_automatic_exports_tasks *
    77  ● manage_categories
    78  ● manage_chat
    79  ● manage_custom_fields
    80  ● manage_custom_notifications
    81  ● manage_emails_templates
    82  ● manage_folders
    83  ● manage_ice
    84  ● manage_identities
    85  ● manage_own_notifications
    86  ● manage_reply_assistant *
    87  ● manage_roles
    88  ● manage_rules_engine_rules *
    89  ● manage_surveys *
    90  ● manage_tags
    91  ● manage_teams
    92  ● manage_topologies
    93  ● manage_users_of_my_teams
    94  ● monitor_tasks
    95  ● monitor_team_tasks
    96  ● mute_content
    97  ● open_content_thread
    98  ● publish_content
    99  ● read_community
   100  ● read_content_source
   101  ● read_event
   102  ● read_export
   103  ● read_identity
   104  ● read_own_stats
   105  ● read_presence
   106  ● read_stats
   107  ● read_surveys *
   108  ● read_user
   109  ● receive_tasks
   110  ● reply_with_assistant *
   111  ● search_contents
   112  ● search_event
   113  ● update_community
   114  ● update_content_source
   115  ● update_extension
   116  ● update_identity
   117  ● update_intervention
   118  ● update_own_intervention
   119  ● update_settings
   120  ● update_time_sheet
   121  ● update_user
   122  ● use_emoji
   123  '
   124  
   125  doc = '
   126  ● category_ids[]: User list of category ids (multiple).
   127  ● email: User email (mandatory).
   128  ● enabled: Whether the user is enabled or not (boolean).
   129  ● external_id: User external id, used for SSO.
   130  ● firstname: User firstname (mandatory).
   131  ● gender: User gender ("man" or "woman").
   132  ● identity_ids[]: User list of identity ids (multiple).
   133  ● lastname: User lastname (mandatory).
   134  ● locale: Language for the user interface.
   135  ● nickname: User nickname.
   136  ● password: User plain password (mandatory).
   137  ● role_id: User role id (mandatory).
   138  ● team_ids[]: User list of team ids (multiple).
   139  ● timezone: Use the timezone endpoint to get the timezone name (String), default is empty for domain timezone.
   140  ● spoken_languages[]: List of locales corresponding to the languages spoken by the user (multiple).
   141  '
   142  
   143  doc = '
   144  ● name: Category name.
   145  ● parent_id: ID of parent category.
   146  ● color: displayed color for the category, see Category colors. | integer
   147  ● mandatory: mandatory categorization (Boolean).
   148  ● multiple: allow to assign multiple child categories (Boolean).
   149  ● post_qualification: post qualification (Boolean).
   150  ● unselectable: root category is unselectable (Boolean).
   151  ● source_ids[]: List of source id. | array:string
   152  '
   153  
   154  doc = '
   155  ● name: The name of the channel.
   156  ● source_ids: An array containing id of each source assigned to a channel (multiple). | array:string
   157  ● soft_capability: Number of tasks that can be assigned to agent by the routing before they are considered "occupied". | integer
   158  ● hard_capability: M​aximum number of tasks that can be assigned to agents. | integer
   159  ● task_timeout_seconds: this field defines the time before a task expires (in seconds). | integer
   160  '
   161  
   162  doc = '
   163  ● associated_type_name: The associated type of custom field. It can be IdentityGroup or Intervention.
   164  ● label: The label of the custom field (mandatory).
   165  ● key: The key of the custom field (example: customer_id). This is used to determine how it is
   166  stored on identity groups.
   167  ● type: The type of the custom field. It can be string, boolean, text, integer, float, single_choice,
   168  or multiple_choice (default: string).
   169  ● choices: A list of choices to be for single_choice, or multiple_choice types. This must be given
   170  as array. | array:string
   171  ● multiple: true or false, this as no effect on single_choice, multiple_choice or boolean types
   172  (default: false). | boolean
   173  ● position: an integer that indicates custom field’s position between others (default: -1). | integer
   174  '
   175  
   176  doc = '● company: Identity company.
   177  ● custom_field_values[custom_field_key]: Identity custom field with key « custom_field_key ». It
   178  can be multiple if custom field is multiple or is has multiple_choice type.
   179  ● emails: Identity emails (multiple).
   180  ● firstname: Identity firstname.
   181  ● gender: Identity’s gender. It can be "man", "woman" or empty.
   182  ● home_phones: Identity home phones (mutiple).
   183  ● lastname: Identity lastname.
   184  ● mobile_phones: Identity mobile phones (multiple).
   185  ● notes: Identity notes.
   186  ● tag_ids: Identity tag ids (multiple).'
   187  
   188  doc = '● agent_ids: List of agents to transfer the task to (multiple).
   189  ● bypass: Force the transfer to the first agent in agent_ids if set. When bypass is used,
   190  agent_ids need to be provided and the other parameters will be ignored.
   191  ● category_ids: Filter agents receiving the task depending on their categories.
   192  ● language: Filter agents receiving the task depending on their spoken languages.
   193  ● team_ids: Filter agents receiving the task depending on their teams.
   194  ● comment: Add a comment to the task.'
   195  
   196  doc = '● active: true or false, this field is used to enable/disable a webhook.
   197  ● label: The label of the webhook (mandatory).
   198  ● staging_use: true or false, this field is used to determine if a webhook will be run in staging
   199  or production.
   200  ● url: The url of a webhook. This is used to determine the endpoint of your webhook, where
   201  the data will be submitted.
   202  ● verify_token: The token used in your webhook.
   203  ● secret: The secret key that will be served as a ​X-Dimelo-Secret​ header in every request.
   204  ● registered_events: An array containing all the events that your webhook wants to subscribe.
   205  '
   206  
   207  doc = '● activity_presence_threshold: (in hours). | integer
   208  ● activity_tracking: ​Enable activity tracking (Boolean)
   209  ● beginning_of_week: (Day of week)
   210  ● category_tagging: A​ ctivate the forced categorization by source.​ (Boolean)
   211  ● content_languages: (See format)
   212  ● dashboard: Activate the dashboard (Boolean)
   213  ● deny_iframe_integration: Prevent the DD to be embed by other websites (Boolean)
   214  ● disable_password_autocomplete: (Boolean)
   215  ● expire_password_after: password expiration delay (in seconds) | integer
   216  ● expire_password_enabled: enable password expiration (Boolean)
   217  ● export_in_seconds: provide durations in seconds in export (Boolean)
   218  ● fold_useless_contents: fold archived contents (Boolean)
   219  ● fte_duration: FTE data period (in hours) | integer
   220  ● identity_merge: enable identity merge (Boolean)
   221  ● intervention_defer_rates[]: (Array of times in seconds) | array:integer
   222  ● intervention_defer_threshold: (in seconds) | integer
   223  ● intervention_rates: (Array of times in seconds) | array:integer
   224  ● locale: locale code (String)
   225  ● multi_lang: activate multi language support for messages (Boolean)
   226  ● name: Name of the Dimelo Digital (String)
   227  ● password_archivable_enabled: prohibit reusing old passwords (Boolean)
   228  ● password_archivable_size: number of archived passwords | integer
   229  ● password_min_length: minimum character length | integer
   230  ● password_non_word: should contain at least 1 non alphanumeric char (Boolean)
   231  ● password_numbers: should contain at least 1 number (Boolean)
   232  ● password_recovery_disabled: disable password recovery by email (Boolean)
   233  ● push_enabled: Enable push mode (Boolean)
   234  ● reply_as_any_identity: Enable reply as any identity (Boolean)
   235  ● rtl_support: Enable right to left support (Boolean)
   236  ● self_approval_required: ​Allow authors to ask approval of their messages (Boolean)
   237  ● session_timeout: Session timeout (in minutes) | integer
   238  ● spellchecking: Enable spellchecking (Boolean)
   239  ● style: Defines the DD’s design (String)
   240  ● third_party_services_disabled: Disable third-party services (tracking...) (Boolean)
   241  ● timezone: Use the timezone endpoint to get the timezone name (String)
   242  ● track_js: Track JS errors (Boolean)
   243  ● type: Can be ‘demo’, ‘production’ or ‘archived’
   244  ● urgent_task_threshold: Chat max response time (in seconds) | integer
   245  ● use_system_font: Experimental (Boolean)'
   246  
   247  doc = 'active: true or false, this field is used to enable/disable a time sheet. | boolean
   248  ● label: The label of the time sheet (mandatory).
   249  ● source_ids: An array containing id of each source using your time sheet. | array:string
   250  ● holidays_region: A string containing the first two letters of your country (example: "fr"/"en"/"es"), useful to bootstrap default holidays following to a country.
   251  ● holidays: An array containing one or more hash of holidays, a holiday must contain a name (string) and a date (string), the date must be in a valid format, a valid format is a format corresponding to your domain’s locale).
   252  ● monday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. For example: “a-b,c-d”: “a” is the beginning of the first interval of the day, “b” is the ending of the first interval of the day, “c” is the beginning of the second interval of the day, “d” is the ending of the second interval of the day
   253  ● tuesday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. See `monday_hours` for the format.
   254  ● wednesday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. See `monday_hours` for the format.
   255  ● thursday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. See `monday_hours` for the format.
   256  ● friday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. See `monday_hours` for the format.
   257  ● saturday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. See `monday_hours` for the format.
   258  ● sunday_hours: this field define the time intervals of the day (in secs). An empty string means that there are no business hours on this day. See `monday_hours` for the format.
   259  '
   260  parameters = []
   261  
   262  doc.split("\n").each_with_index do |line,i|
   263    puts "LINE[#{i}] " + line
   264    if line =~ /^●?\s*([\w\[\]]+)\s*:\s*(.+)\s*$/
   265      name = $1
   266      desc = $2.strip
   267      type = ''
   268      format = ''
   269      items = {}
   270      param = {name: name, in: 'query', required: false}
   271      if desc =~ /^\s*(.+)\s*\|\s*(.+):(.+)\s*$/
   272        desc = $1.strip
   273        type = $2
   274        if type == 'array'
   275          items = {type: $3}
   276        end
   277      elsif desc =~ /^\s*(.+)\s*\|\s*(.+)\s*\.?\s*$/
   278        desc = $1
   279        type = $2
   280      elsif desc =~/\((\w+)\)/
   281        type_raw = $1.strip.downcase
   282        if type_raw == 'seconds'
   283          type = 'integer'
   284        elsif type_raw == 'mandatory'
   285          type = 'string'
   286          param[:required] = true
   287        elsif type_raw == 'multiple'
   288          type = 'array'
   289          items = {type: 'string'}
   290        else 
   291          type = type_raw
   292        end
   293      end
   294      param[:required] = false
   295      desc.gsub!(/\s*\(mandatory\)/,'')
   296      param[:description] = desc.strip
   297      if type.length > 0
   298        param[:schema] = {} unless param.key? :schema
   299        param[:schema][:type] = type
   300      else
   301          param[:schema] = {} unless param.key? :schema
   302          param[:schema][:type] = 'string'
   303      end
   304      if format.length > 0
   305        param[:format] = format
   306      end
   307      if type == 'array'
   308        if items.length >0 
   309          param[:schema][:items] = items
   310        end
   311      end
   312      parameters.push param
   313    elsif line =~ /^●?\s*(\w+)(\s*\*\s*)?$/
   314      name = $1.strip
   315      desc = $2 || ''
   316      desc.strip!
   317      param = {name: name, in: 'query', required: false}
   318      if desc == "*"
   319        param[:description] = "permission only available with the corresponding extension enabled"
   320      end
   321      param[:schema] = {} unless param.key? :schema
   322      param[:schema][:type] = 'boolean'
   323      parameters.push param
   324    else
   325      puts "E_NO_MATCH: " + line
   326    end
   327  end
   328  
   329  puts doc
   330  
   331  puts MultiJson.encode parameters, pretty: true