All Projects → galeone → Rts

galeone / Rts

Licence: other
RTS: request to struct. Generates Go structs from JSON server responses.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Rts

Xidel
Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
Stars: ✭ 335 (+62.62%)
Mutual labels:  rest, cli, json
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+25653.4%)
Mutual labels:  rest, cli, json
Restinstance
Robot Framework library for RESTful JSON APIs
Stars: ✭ 157 (-23.79%)
Mutual labels:  rest, json
Webtau
Webtau (short for web test automation) is a testing API, command line tool and a framework to write unit, integration and end-to-end tests. Test across REST-API, Graph QL, Browser, Database, CLI and Business Logic with consistent set of matchers and concepts. REPL mode speeds-up tests development. Rich reporting cuts down investigation time.
Stars: ✭ 156 (-24.27%)
Mutual labels:  rest, cli
Live Stream Radio
24/7 live stream video radio station CLI / API 📹 📻
Stars: ✭ 175 (-15.05%)
Mutual labels:  cli, json
Restclient.net
.NET REST Client Framework for all platforms
Stars: ✭ 143 (-30.58%)
Mutual labels:  rest, json
Grafanajsondatasource
Grafana datasource to load JSON data over your arbitrary HTTP backend
Stars: ✭ 146 (-29.13%)
Mutual labels:  rest, json
Api Diff
A command line tool for diffing json rest APIs
Stars: ✭ 164 (-20.39%)
Mutual labels:  rest, json
Oq
A performant, and portable jq wrapper to facilitate the consumption and output of formats other than JSON; using jq filters to transform the data.
Stars: ✭ 132 (-35.92%)
Mutual labels:  cli, json
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-8.74%)
Mutual labels:  cli, json
Vcspull
🔄 synchronize projects via yaml/json manifest. built on libvcs
Stars: ✭ 187 (-9.22%)
Mutual labels:  cli, json
Flexirest
Flexirest - The really flexible REST API client for Ruby
Stars: ✭ 188 (-8.74%)
Mutual labels:  rest, json
Smoke
💨 Simple yet powerful file-based mock server with recording abilities
Stars: ✭ 142 (-31.07%)
Mutual labels:  rest, json
Aping
angular module to get and display data by adding html-attributes
Stars: ✭ 135 (-34.47%)
Mutual labels:  rest, json
Keycloak Config Cli
Import YAML/JSON-formatted configuration files into Keycloak - Configuration as Code for Keycloak.
Stars: ✭ 147 (-28.64%)
Mutual labels:  rest, json
Httpexpect
End-to-end HTTP and REST API testing for Go.
Stars: ✭ 1,821 (+783.98%)
Mutual labels:  rest, json
Goat
[DEPRECATED] 🐐 A minimalistic JSON API server in Go
Stars: ✭ 161 (-21.84%)
Mutual labels:  rest, json
Jl
jl — JSON Logs, a development tool for working with structured JSON logging.
Stars: ✭ 194 (-5.83%)
Mutual labels:  cli, json
Jsonfui
jsonfui is an interactive command-line JSON viewer.
Stars: ✭ 125 (-39.32%)
Mutual labels:  cli, json
Jsonwatch
Track changes in JSON data from the command line
Stars: ✭ 130 (-36.89%)
Mutual labels:  cli, json

RTS: Request to Struct

GoDoc Build Status

Generate Go structs definitions from JSON server responses.

RTS defines type names using the specified lines in the route file and skipping numbers. e.g: a request to a route like /users/1/posts generates type UsersPosts

It supports parameters: a line like /users/:user/posts/:pid 1 200 generates type UsersUserPostsPid from the response to the request GET /users/1/posts/200.

RTS supports headers personalization as well, thus it can be used to generate types from responses protected by some authorization method

Updated: 6/17/2016 by Krish Verma https://github.com/kverma

In case the JSON server is HTTPS with unknown certificate signing authority, pass the -insecure flag to disable TLS certificate check

Install

CLI Application

go get -u github.com/galeone/rts/cmd/rts

Library

import "github.com/galeone/rts"

byteFile, err := rts.Do(pkg, server, lines, headerMap)

CLI Usage

rts [options]
  -headers string
    	Headers to add in every request
  -help
    	prints this help
  -insecure
    	Disables TLS Certificate check for HTTPS, use in case HTTPS Server Certificate is signed by an unknown authority
  -out string
    	Output file. Stdout is used if not specified
  -pkg string
    	Package name (default "main")
  -routes string
    	Routes to request. One per line (default "routes.txt")
  -server string
    	sets the server address (default "http://localhost:9090")
  -substruct
    	Creates types for sub-structs

Example

routes.txt:

/
/repos/:user/:repo galeone igor

Run:

rts -server https://api.github.com -pkg example

Returns:

package example

type Foo1 struct {
	AuthorizationsURL                string `json:"authorizations_url"`
	CodeSearchURL                    string `json:"code_search_url"`
	CurrentUserAuthorizationsHTMLURL string `json:"current_user_authorizations_html_url"`
	CurrentUserRepositoriesURL       string `json:"current_user_repositories_url"`
	CurrentUserURL                   string `json:"current_user_url"`
	EmailsURL                        string `json:"emails_url"`
	EmojisURL                        string `json:"emojis_url"`
	EventsURL                        string `json:"events_url"`
	FeedsURL                         string `json:"feeds_url"`
	FollowersURL                     string `json:"followers_url"`
	FollowingURL                     string `json:"following_url"`
	GistsURL                         string `json:"gists_url"`
	HubURL                           string `json:"hub_url"`
	IssueSearchURL                   string `json:"issue_search_url"`
	IssuesURL                        string `json:"issues_url"`
	KeysURL                          string `json:"keys_url"`
	NotificationsURL                 string `json:"notifications_url"`
	OrganizationRepositoriesURL      string `json:"organization_repositories_url"`
	OrganizationURL                  string `json:"organization_url"`
	PublicGistsURL                   string `json:"public_gists_url"`
	RateLimitURL                     string `json:"rate_limit_url"`
	RepositorySearchURL              string `json:"repository_search_url"`
	RepositoryURL                    string `json:"repository_url"`
	StarredGistsURL                  string `json:"starred_gists_url"`
	StarredURL                       string `json:"starred_url"`
	TeamURL                          string `json:"team_url"`
	UserOrganizationsURL             string `json:"user_organizations_url"`
	UserRepositoriesURL              string `json:"user_repositories_url"`
	UserSearchURL                    string `json:"user_search_url"`
	UserURL                          string `json:"user_url"`
}

type ReposUserRepo struct {
	ArchiveURL       string      `json:"archive_url"`
	AssigneesURL     string      `json:"assignees_url"`
	BlobsURL         string      `json:"blobs_url"`
	BranchesURL      string      `json:"branches_url"`
	CloneURL         string      `json:"clone_url"`
	CollaboratorsURL string      `json:"collaborators_url"`
	CommentsURL      string      `json:"comments_url"`
	CommitsURL       string      `json:"commits_url"`
	CompareURL       string      `json:"compare_url"`
	ContentsURL      string      `json:"contents_url"`
	ContributorsURL  string      `json:"contributors_url"`
	CreatedAt        string      `json:"created_at"`
	DefaultBranch    string      `json:"default_branch"`
	DeploymentsURL   string      `json:"deployments_url"`
	Description      string      `json:"description"`
	DownloadsURL     string      `json:"downloads_url"`
	EventsURL        string      `json:"events_url"`
	Fork             bool        `json:"fork"`
	Forks            int         `json:"forks"`
	ForksCount       int         `json:"forks_count"`
	ForksURL         string      `json:"forks_url"`
	FullName         string      `json:"full_name"`
	GitCommitsURL    string      `json:"git_commits_url"`
	GitRefsURL       string      `json:"git_refs_url"`
	GitTagsURL       string      `json:"git_tags_url"`
	GitURL           string      `json:"git_url"`
	HasDownloads     bool        `json:"has_downloads"`
	HasIssues        bool        `json:"has_issues"`
	HasPages         bool        `json:"has_pages"`
	HasWiki          bool        `json:"has_wiki"`
	Homepage         string      `json:"homepage"`
	HooksURL         string      `json:"hooks_url"`
	HTMLURL          string      `json:"html_url"`
	ID               int         `json:"id"`
	IssueCommentURL  string      `json:"issue_comment_url"`
	IssueEventsURL   string      `json:"issue_events_url"`
	IssuesURL        string      `json:"issues_url"`
	KeysURL          string      `json:"keys_url"`
	LabelsURL        string      `json:"labels_url"`
	Language         string      `json:"language"`
	LanguagesURL     string      `json:"languages_url"`
	MergesURL        string      `json:"merges_url"`
	MilestonesURL    string      `json:"milestones_url"`
	MirrorURL        interface{} `json:"mirror_url"`
	Name             string      `json:"name"`
	NetworkCount     int         `json:"network_count"`
	NotificationsURL string      `json:"notifications_url"`
	OpenIssues       int         `json:"open_issues"`
	OpenIssuesCount  int         `json:"open_issues_count"`
	Owner            struct {
		AvatarURL         string `json:"avatar_url"`
		EventsURL         string `json:"events_url"`
		FollowersURL      string `json:"followers_url"`
		FollowingURL      string `json:"following_url"`
		GistsURL          string `json:"gists_url"`
		GravatarID        string `json:"gravatar_id"`
		HTMLURL           string `json:"html_url"`
		ID                int    `json:"id"`
		Login             string `json:"login"`
		OrganizationsURL  string `json:"organizations_url"`
		ReceivedEventsURL string `json:"received_events_url"`
		ReposURL          string `json:"repos_url"`
		SiteAdmin         bool   `json:"site_admin"`
		StarredURL        string `json:"starred_url"`
		SubscriptionsURL  string `json:"subscriptions_url"`
		Type              string `json:"type"`
		URL               string `json:"url"`
	} `json:"owner"`
	Private          bool   `json:"private"`
	PullsURL         string `json:"pulls_url"`
	PushedAt         string `json:"pushed_at"`
	ReleasesURL      string `json:"releases_url"`
	Size             int    `json:"size"`
	SSHURL           string `json:"ssh_url"`
	StargazersCount  int    `json:"stargazers_count"`
	StargazersURL    string `json:"stargazers_url"`
	StatusesURL      string `json:"statuses_url"`
	SubscribersCount int    `json:"subscribers_count"`
	SubscribersURL   string `json:"subscribers_url"`
	SubscriptionURL  string `json:"subscription_url"`
	SvnURL           string `json:"svn_url"`
	TagsURL          string `json:"tags_url"`
	TeamsURL         string `json:"teams_url"`
	TreesURL         string `json:"trees_url"`
	UpdatedAt        string `json:"updated_at"`
	URL              string `json:"url"`
	Watchers         int    `json:"watchers"`
	WatchersCount    int    `json:"watchers_count"`
}

License

RTS: Request to Struct. Generates Go structs from a server response. Copyright (C) 2016 Paolo Galeone [email protected]

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/. Exhibit B is not attached; this software is compatible with the licenses expressed under Section 1.12 of the MPL v2.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].