Skip to content
Snippets Groups Projects
Commit 505b15aa authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

:sparkles: Feature: now generating a full API client

parent 2b62da51
No related branches found
No related tags found
1 merge request!16WIP: Add grpc-gateway support
Pipeline #
Showing
with 385 additions and 1 deletion
Loading
Loading
@@ -20,8 +20,18 @@ ENV['PATH'] = [
 
def main
FileUtils.rm(Dir['go/**/*.pb.go'])
FileUtils.rm(Dir['gateway/**/*.pb.gw.go'])
FileUtils.rm(Dir['swagger/**'])
run!(%W[protoc -I#{GO_PATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I #{PROTO_INCLUDE}] + PROTO_FILES + %w[--go_out=plugins=grpc:go --grpc-gateway_out=go --swagger_out=logtostderr=true:swagger])
run!(%W[protoc -I#{GO_PATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I #{PROTO_INCLUDE}] + PROTO_FILES + %w[--go_out=plugins=grpc:go --grpc-gateway_out=gateway --swagger_out=logtostderr=true:swagger])
# Merge the swagger definitions into a single file
run!(%W[#{__dir__}/merge-swagger-definitions])
# Generate a swagger client
FileUtils.rm(Dir['ruby_swagger/**/*.rb'])
run!(%W[swagger-codegen generate -i swagger/main.json -l ruby -o ruby_swagger/])
 
FileUtils.rm(Dir[File.join(RUBY_PREFIX, '**/*_pb.rb')])
ruby_lib_gitaly = File.join(RUBY_PREFIX, 'gitaly')
Loading
Loading
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${DIR}/../swagger"
echo "{}" > main.json
for i in *.swagger.json; do
jq -s '.[0] * .[1]' $i main.json > main.json.tmp
mv main.json.tmp main.json
done
File moved
File moved
File moved
File moved
File moved
File moved
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
## Specific to RubyMotion:
.dat*
.repl_history
build/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
--color
--require spec_helper
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
source 'https://rubygems.org'
gemspec
group :development, :test do
gem 'rake', '~> 12.0.0'
end
# swagger_client
SwaggerClient - the Ruby gem for the commit.proto
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: version not set
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.RubyClientCodegen
## Installation
### Build a gem
To build the Ruby code into a gem:
```shell
gem build swagger_client.gemspec
```
Then either install the gem locally:
```shell
gem install ./swagger_client-1.0.0.gem
```
(for development, run `gem install --dev ./swagger_client-1.0.0.gem` to install the development dependencies)
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
Finally add this to the Gemfile:
gem 'swagger_client', '~> 1.0.0'
### Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
gem 'swagger_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
### Include the Ruby code directly
Include the Ruby code directly using `-I` as follows:
```shell
ruby -Ilib script.rb
```
## Getting Started
Please follow the [installation](#installation) procedure and then run the following code:
```ruby
# Load the gem
require 'swagger_client'
api_instance = SwaggerClient::CommitApi.new
body = SwaggerClient::GitalyCommitIsAncestorRequest.new # GitalyCommitIsAncestorRequest |
begin
result = api_instance.commit_is_ancestor(body)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling CommitApi->commit_is_ancestor: #{e}"
end
```
## Documentation for API Endpoints
All URIs are relative to *http://localhost*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*SwaggerClient::CommitApi* | [**commit_is_ancestor**](docs/CommitApi.md#commit_is_ancestor) | **POST** /v1/commit/commit_is_ancestor |
*SwaggerClient::DiffApi* | [**commit_diff**](docs/DiffApi.md#commit_diff) | **POST** /v1/diff/commit_diff | Returns stream of CommitDiffResponse: 1 per changed file
*SwaggerClient::NotificationsApi* | [**post_receive**](docs/NotificationsApi.md#post_receive) | **POST** /v1/notification/post_receive |
*SwaggerClient::RefApi* | [**find_all_branch_names**](docs/RefApi.md#find_all_branch_names) | **POST** /v1/ref/find_all_branch_names |
*SwaggerClient::RefApi* | [**find_all_tag_names**](docs/RefApi.md#find_all_tag_names) | **POST** /v1/ref/find_all_tag_names |
*SwaggerClient::RefApi* | [**find_default_branch_name**](docs/RefApi.md#find_default_branch_name) | **POST** /v1/ref/find_default_branch_name |
*SwaggerClient::RefApi* | [**find_local_branches**](docs/RefApi.md#find_local_branches) | **POST** /v1/ref/find_local_branches | Return a stream so we can divide the response in chunks of branches
*SwaggerClient::RefApi* | [**find_ref_name**](docs/RefApi.md#find_ref_name) | **POST** /v1/ref/find_ref_name | Find a Ref matching the given constraints. Response may be empty.
*SwaggerClient::SSHApi* | [**s_sh_receive_pack**](docs/SSHApi.md#s_sh_receive_pack) | **POST** /v1/ssh/ssh_receive_pack | To forward 'git receive-pack' to Gitaly for SSH sessions
*SwaggerClient::SSHApi* | [**s_sh_upload_pack**](docs/SSHApi.md#s_sh_upload_pack) | **POST** /v1/ssh/ssh_upload_pack | To forward 'git upload-pack' to Gitaly for SSH sessions
*SwaggerClient::SmartHTTPApi* | [**info_refs_receive_pack**](docs/SmartHTTPApi.md#info_refs_receive_pack) | **POST** /v1/smart_http/info_refs_receive_pack | The response body for GET /info/refs?service=git-receive-pack
*SwaggerClient::SmartHTTPApi* | [**info_refs_upload_pack**](docs/SmartHTTPApi.md#info_refs_upload_pack) | **POST** /v1/smart_http/info_refs_upload_pack | The response body for GET /info/refs?service=git-upload-pack
*SwaggerClient::SmartHTTPApi* | [**post_receive_pack**](docs/SmartHTTPApi.md#post_receive_pack) | **POST** /v1/smart_http/post_receive_pack | Request and response body for POST /receive-pack
*SwaggerClient::SmartHTTPApi* | [**post_upload_pack**](docs/SmartHTTPApi.md#post_upload_pack) | **POST** /v1/smart_http/post_upload_pack | Request and response body for POST /upload-pack
## Documentation for Models
- [SwaggerClient::FindLocalBranchesRequestSortBy](docs/FindLocalBranchesRequestSortBy.md)
- [SwaggerClient::GitalyCommitDiffRequest](docs/GitalyCommitDiffRequest.md)
- [SwaggerClient::GitalyCommitDiffResponse](docs/GitalyCommitDiffResponse.md)
- [SwaggerClient::GitalyCommitIsAncestorRequest](docs/GitalyCommitIsAncestorRequest.md)
- [SwaggerClient::GitalyCommitIsAncestorResponse](docs/GitalyCommitIsAncestorResponse.md)
- [SwaggerClient::GitalyExitStatus](docs/GitalyExitStatus.md)
- [SwaggerClient::GitalyFindAllBranchNamesRequest](docs/GitalyFindAllBranchNamesRequest.md)
- [SwaggerClient::GitalyFindAllBranchNamesResponse](docs/GitalyFindAllBranchNamesResponse.md)
- [SwaggerClient::GitalyFindAllTagNamesRequest](docs/GitalyFindAllTagNamesRequest.md)
- [SwaggerClient::GitalyFindAllTagNamesResponse](docs/GitalyFindAllTagNamesResponse.md)
- [SwaggerClient::GitalyFindDefaultBranchNameRequest](docs/GitalyFindDefaultBranchNameRequest.md)
- [SwaggerClient::GitalyFindDefaultBranchNameResponse](docs/GitalyFindDefaultBranchNameResponse.md)
- [SwaggerClient::GitalyFindLocalBranchCommitAuthor](docs/GitalyFindLocalBranchCommitAuthor.md)
- [SwaggerClient::GitalyFindLocalBranchResponse](docs/GitalyFindLocalBranchResponse.md)
- [SwaggerClient::GitalyFindLocalBranchesRequest](docs/GitalyFindLocalBranchesRequest.md)
- [SwaggerClient::GitalyFindLocalBranchesResponse](docs/GitalyFindLocalBranchesResponse.md)
- [SwaggerClient::GitalyFindRefNameRequest](docs/GitalyFindRefNameRequest.md)
- [SwaggerClient::GitalyFindRefNameResponse](docs/GitalyFindRefNameResponse.md)
- [SwaggerClient::GitalyInfoRefsRequest](docs/GitalyInfoRefsRequest.md)
- [SwaggerClient::GitalyInfoRefsResponse](docs/GitalyInfoRefsResponse.md)
- [SwaggerClient::GitalyPostReceivePackRequest](docs/GitalyPostReceivePackRequest.md)
- [SwaggerClient::GitalyPostReceivePackResponse](docs/GitalyPostReceivePackResponse.md)
- [SwaggerClient::GitalyPostReceiveRequest](docs/GitalyPostReceiveRequest.md)
- [SwaggerClient::GitalyPostReceiveResponse](docs/GitalyPostReceiveResponse.md)
- [SwaggerClient::GitalyPostUploadPackRequest](docs/GitalyPostUploadPackRequest.md)
- [SwaggerClient::GitalyPostUploadPackResponse](docs/GitalyPostUploadPackResponse.md)
- [SwaggerClient::GitalyRepository](docs/GitalyRepository.md)
- [SwaggerClient::GitalySSHReceivePackRequest](docs/GitalySSHReceivePackRequest.md)
- [SwaggerClient::GitalySSHReceivePackResponse](docs/GitalySSHReceivePackResponse.md)
- [SwaggerClient::GitalySSHUploadPackRequest](docs/GitalySSHUploadPackRequest.md)
- [SwaggerClient::GitalySSHUploadPackResponse](docs/GitalySSHUploadPackResponse.md)
## Documentation for Authorization
All endpoints do not require authorization.
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError
# no rspec available
end
# SwaggerClient::CommitApi
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**commit_is_ancestor**](CommitApi.md#commit_is_ancestor) | **POST** /v1/commit/commit_is_ancestor |
# **commit_is_ancestor**
> GitalyCommitIsAncestorResponse commit_is_ancestor(body)
### Example
```ruby
# load the gem
require 'swagger_client'
api_instance = SwaggerClient::CommitApi.new
body = SwaggerClient::GitalyCommitIsAncestorRequest.new # GitalyCommitIsAncestorRequest |
begin
result = api_instance.commit_is_ancestor(body)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling CommitApi->commit_is_ancestor: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**GitalyCommitIsAncestorRequest**](GitalyCommitIsAncestorRequest.md)| |
### Return type
[**GitalyCommitIsAncestorResponse**](GitalyCommitIsAncestorResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# SwaggerClient::DiffApi
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**commit_diff**](DiffApi.md#commit_diff) | **POST** /v1/diff/commit_diff | Returns stream of CommitDiffResponse: 1 per changed file
# **commit_diff**
> GitalyCommitDiffResponse commit_diff(body)
Returns stream of CommitDiffResponse: 1 per changed file
### Example
```ruby
# load the gem
require 'swagger_client'
api_instance = SwaggerClient::DiffApi.new
body = SwaggerClient::GitalyCommitDiffRequest.new # GitalyCommitDiffRequest |
begin
#Returns stream of CommitDiffResponse: 1 per changed file
result = api_instance.commit_diff(body)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling DiffApi->commit_diff: #{e}"
end
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**GitalyCommitDiffRequest**](GitalyCommitDiffRequest.md)| |
### Return type
[**GitalyCommitDiffResponse**](GitalyCommitDiffResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
# SwaggerClient::FindLocalBranchesRequestSortBy
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
# SwaggerClient::GitalyCommitDiffRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**repository** | [**GitalyRepository**](GitalyRepository.md) | | [optional]
**left_commit_id** | **String** | | [optional]
**right_commit_id** | **String** | | [optional]
# SwaggerClient::GitalyCommitDiffResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**from_path** | **String** | | [optional]
**to_path** | **String** | | [optional]
**from_id** | **String** | | [optional]
**to_id** | **String** | | [optional]
**old_mode** | **Integer** | | [optional]
**new_mode** | **Integer** | | [optional]
**binary** | **BOOLEAN** | | [optional]
**raw_chunks** | **Array&lt;String&gt;** | | [optional]
# SwaggerClient::GitalyCommitIsAncestorRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**repository** | [**GitalyRepository**](GitalyRepository.md) | | [optional]
**ancestor_id** | **String** | | [optional]
**child_id** | **String** | | [optional]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment