<commit_before>## <%= title %>
<%= schema['description'] %>

<%- if schema['properties'] %>
### Attributes
<table>
  <tr>
    <th>Name</th>
    <th>Type</th>
    <th>Description</th>
    <th>Example</th>
  </tr>
  <%- extract_attributes(schemata, schema['properties']).each do |(key, type, description, example)| %>
  <tr>
    <td><strong><%= key %></strong></td>
    <td><em><%= type %></em></td>
    <td><%= description %></td>
    <td><%= example %></td>
  </tr>
  <%- end %>
</table>

<%- end %>
<%- schema['links'].each do |link, datum| %>
<%- path = link['href'].gsub(%r|(\{\([^\)]+\)\})|) do |ref|
  ref = ref.gsub('%2F', '/').gsub('%23', '#').gsub(%r|[\{\(\)\}]|, '')
  resource = ref.split('#').first.split('/').last.gsub('-', '_')
  property = ref.split('#').last.split('/').last
  '{' + resource + '_' + property + '}'
end
-%>
### <%= title %> <%= link['title'] %>
<%= link['description'] %>

```
<%= link['method'] %> <%= path %>
```

<%- if link.has_key?('schema') && link['schema'].has_key?('properties') %>
<%-
  required, optional = link['schema']['properties'].partition do |k, v|
    (link['schema']['required'] || []).include?(k)
  end.map { |partition| Hash[partition] }
%>
<%- unless required.empty? %>
#### Required Parameters
<%= Erubis::Eruby.new(params_template).result(params: required, schemata: schemata) %>

<%- end %>
<%- unless optional.empty? %>
#### Optional Parameters
<%= Erubis::Eruby.new(params_template).result(params: optional, schemata: schemata) %>
<%- end %>
<%- end %>

#### Curl Example
```term
$ curl -n -X <%= link['method'] %> https://api.heroku.com<%= path.gsub(/{([^}]*)}/) {|match| '$' + match.gsub(/[{}]/, '').gsub('-', '_').upcase} %><%- if link.has_key?('schema') && (link['schema'].has_key?('properties') || link['schema'].has_key?('example')) %> \
-H "Content-Type: application/json" \
<%-
  data = {}
  if link['schema']['properties']
    link['schema']['properties'].each do |key, value|
      unless value.has_key?('anyOf')
        data[key] = value['example']
      else
        id_ref = value['anyOf'].detect {|ref| ref['$ref'].split('/').last == 'id'}
        data[key] = dereference(schemata, id_ref)['example']
      end
    end
  else
    data.merge!(link['schema']['example'])
  end
%>
-d <%= data.to_json.inspect %>
<%- else %>

<%- end %>
```

#### Response Example
```
HTTP/1.1 <%= case link['rel']
when 'create'
  '201 Created'
else
  '200 OK'
end %>
<%- if link['rel'] == 'instances' && identifiers %>
Accept-Range: <%= identifiers.join(', ') %>
Content-Range: id 01234567-89ab-cdef-0123-456789abcdef..01234567-89ab-cdef-0123-456789abcdef; max=200<commit_msg>single quote bodies in curl examples<commit_after>## <%= title %>
<%= schema['description'] %>

<%- if schema['properties'] %>
### Attributes
<table>
  <tr>
    <th>Name</th>
    <th>Type</th>
    <th>Description</th>
    <th>Example</th>
  </tr>
  <%- extract_attributes(schemata, schema['properties']).each do |(key, type, description, example)| %>
  <tr>
    <td><strong><%= key %></strong></td>
    <td><em><%= type %></em></td>
    <td><%= description %></td>
    <td><%= example %></td>
  </tr>
  <%- end %>
</table>

<%- end %>
<%- schema['links'].each do |link, datum| %>
<%- path = link['href'].gsub(%r|(\{\([^\)]+\)\})|) do |ref|
  ref = ref.gsub('%2F', '/').gsub('%23', '#').gsub(%r|[\{\(\)\}]|, '')
  resource = ref.split('#').first.split('/').last.gsub('-', '_')
  property = ref.split('#').last.split('/').last
  '{' + resource + '_' + property + '}'
end
-%>
### <%= title %> <%= link['title'] %>
<%= link['description'] %>

```
<%= link['method'] %> <%= path %>
```

<%- if link.has_key?('schema') && link['schema'].has_key?('properties') %>
<%-
  required, optional = link['schema']['properties'].partition do |k, v|
    (link['schema']['required'] || []).include?(k)
  end.map { |partition| Hash[partition] }
%>
<%- unless required.empty? %>
#### Required Parameters
<%= Erubis::Eruby.new(params_template).result(params: required, schemata: schemata) %>

<%- end %>
<%- unless optional.empty? %>
#### Optional Parameters
<%= Erubis::Eruby.new(params_template).result(params: optional, schemata: schemata) %>
<%- end %>
<%- end %>

#### Curl Example
```term
$ curl -n -X <%= link['method'] %> https://api.heroku.com<%= path.gsub(/{([^}]*)}/) {|match| '$' + match.gsub(/[{}]/, '').gsub('-', '_').upcase} %><%- if link.has_key?('schema') && (link['schema'].has_key?('properties') || link['schema'].has_key?('example')) %> \
-H "Content-Type: application/json" \
<%-
  data = {}
  if link['schema']['properties']
    link['schema']['properties'].each do |key, value|
      unless value.has_key?('anyOf')
        data[key] = value['example']
      else
        id_ref = value['anyOf'].detect {|ref| ref['$ref'].split('/').last == 'id'}
        data[key] = dereference(schemata, id_ref)['example']
      end
    end
  else
    data.merge!(link['schema']['example'])
  end
%>
-d '<%= data.to_json %>'
<%- else %>

<%- end %>
```

#### Response Example
```
HTTP/1.1 <%= case link['rel']
when 'create'
  '201 Created'
else
  '200 OK'
end %>
<%- if link['rel'] == 'instances' && identifiers %>
Accept-Range: <%= identifiers.join(', ') %>
Content-Range: id 01234567-89ab-cdef-0123-456789abcdef..01234567-89ab-cdef-0123-456789abcdef; max=200
{'fraction_non_alphanumeric': 0.28872037914691945, 'fraction_numerical': 0.020473933649289098, 'mean_word_length': 4.010446343779677, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 127, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3800013', 'n_tokens_mistral': 2133, 'n_tokens_neox': 1890, 'n_words': 336}