Class HttpSnippetCodeGenerator


  • public class HttpSnippetCodeGenerator
    extends java.lang.Object
    An http snippet the list of available codeGenerators class that relies on the popular Har format to create code snippets. This converter supports many languages and tools including: cURL, HTTPie, Javascript, Node, C, Java, PHP, Objective-C, Swift, Python, Ruby, C#, Go, OCaml and more!
    • Constructor Detail

      • HttpSnippetCodeGenerator

        public HttpSnippetCodeGenerator()
      • HttpSnippetCodeGenerator

        public HttpSnippetCodeGenerator​(@NonNull
                                        @NonNull CodeGenerator... codeGenerators)
      • HttpSnippetCodeGenerator

        public HttpSnippetCodeGenerator​(@NonNull
                                        @NonNull java.util.List<CodeGenerator> codeGenerators)
    • Method Detail

      • snippet

        public HttpSnippet snippet​(@NonNull
                                   @NonNull io.github.atkawa7.har.HarRequest harRequest,
                                   @NonNull
                                   @NonNull java.lang.String language,
                                   @NonNull
                                   @NonNull java.lang.String client)
                            throws java.lang.Exception
        Parameters:
        harRequest - The object contains detailed info about performed request.
        language - The target programming language
        client - The target client for the target programming language
        Returns:
        The http snippet for a target. The target is searched from a list of available targets findGenerator using language and client
        Throws:
        java.lang.Exception - throws exception
      • snippet

        public HttpSnippet snippet​(@NonNull
                                   @NonNull io.github.atkawa7.har.HarRequest harRequest,
                                   @NonNull
                                   @NonNull java.lang.String language)
                            throws java.lang.Exception
        Parameters:
        harRequest - The object contains detailed info about performed request.
        language - The target programming language
        Returns:
        The http snippet for a code generator. Finds language and uses the default client for a language to search through the list of available code generators.
        Throws:
        java.lang.Exception - throws Exception
      • snippet

        public HttpSnippet snippet​(@NonNull
                                   @NonNull io.github.atkawa7.har.HarRequest harRequest,
                                   @NonNull
                                   @NonNull Language language,
                                   @NonNull
                                   @NonNull Client client)
                            throws java.lang.Exception
        Parameters:
        harRequest - The object contains detailed info about performed request.
        language - The target programming language
        client - The target client for the target programming language
        Returns:
        The http snippet for a target. The target is searched from a list of available targets findGenerator using language and client
        Throws:
        java.lang.Exception - throws Exception
      • snippet

        public HttpSnippet snippet​(@NonNull
                                   @NonNull io.github.atkawa7.har.HarRequest harRequest,
                                   @NonNull
                                   @NonNull Language language)
                            throws java.lang.Exception
        Parameters:
        harRequest - The object contains detailed info about performed request.
        language - The target programming language
        Returns:
        The http snippet for a code generator. Uses the default client for a language to search through the list of available code generators.
        Throws:
        java.lang.Exception - throws Exception
      • snippets

        public java.util.List<HttpSnippet> snippets​(@NonNull
                                                    @NonNull io.github.atkawa7.har.HarRequest harRequest)
                                             throws java.lang.Exception
        Parameters:
        harRequest - The object contains detailed info about performed request.
        Returns:
        The list of http snippets using generators
        Throws:
        java.lang.Exception - when fails to convert post data to json