<commit_before>// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this 
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

namespace ServiceStack.Documentation.Postman.Services
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Documentation.Models;
    using Extensions;
    using Models;
    using Text;

    public class PostmanModelGenerator
    {
        public Dictionary<string, string> FriendlyTypeNames = new Dictionary<string, string>
        {
            {"Int32", "int"},
            {"Int64", "long"},
            {"Boolean", "bool"},
            {"String", "string"},
            {"Double", "double"},
            {"Single", "float"},
        };

        public PostmanSpecCollection GetPostmanCollection(ApiDocumentation documentation)
        {
            // TODO Use SS AutoMapping for this?
            // Convert apiDocumentation to postman spec
            var collection = new PostmanSpecCollection();

            var collectionId = Guid.NewGuid().ToString();
            collection.Id = collectionId;
            collection.Name = documentation.Title;
            collection.Description = documentation.Description;
            collection.Timestamp = DateTime.UtcNow.ToUnixTimeMs();

            PopulateRequests(documentation, collection);

            return collection;
        }

        private void PopulateRequests(ApiDocumentation documentation, PostmanSpecCollection collection)
        {
            var requests = new List<PostmanSpecRequest>();

            foreach (var resource in documentation.Resources)
            {
                var folder = CreateFolder(resource);<commit_msg>Missed from last checkin as file not saved<commit_after>// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this 
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

namespace ServiceStack.Documentation.Postman.Services
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Documentation.Models;
    using Extensions;
    using Models;
    using Text;

    public class PostmanCollectionGenerator
    {
        public Dictionary<string, string> FriendlyTypeNames = new Dictionary<string, string>
        {
            {"Int32", "int"},
            {"Int64", "long"},
            {"Boolean", "bool"},
            {"String", "string"},
            {"Double", "double"},
            {"Single", "float"},
        };

        public PostmanSpecCollection Generate(ApiDocumentation documentation)
        {
            // TODO Use SS AutoMapping for this?
            // Convert apiDocumentation to postman spec
            var collection = new PostmanSpecCollection();

            var collectionId = Guid.NewGuid().ToString();
            collection.Id = collectionId;
            collection.Name = documentation.Title;
            collection.Description = documentation.Description;
            collection.Timestamp = DateTime.UtcNow.ToUnixTimeMs();

            PopulateRequests(documentation, collection);

            return collection;
        }

        private void PopulateRequests(ApiDocumentation documentation, PostmanSpecCollection collection)
        {
            var requests = new List<PostmanSpecRequest>();

            foreach (var resource in documentation.Resources)
            {
                var folder = CreateFolder(resource);
{'fraction_non_alphanumeric': 0.08983050847457627, 'fraction_numerical': 0.004519774011299435, 'mean_word_length': 2.2726432532347505, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '7397327', 'n_tokens_mistral': 849, 'n_tokens_neox': 820, 'n_words': 256}