Skip to content

Commit fc6012c

Browse files
committed
Minor update
1 parent 5407901 commit fc6012c

26 files changed

+3500
-0
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
23+
*.test
24+
*.prof

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/FILES

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.gitignore
2+
.openapi-generator-ignore
3+
.travis.yml
4+
README.md
5+
api/openapi.yaml
6+
api_customer.go
7+
client.go
8+
configuration.go
9+
docs/CustomerAPI.md
10+
docs/CustomerPost200Response.md
11+
docs/CustomerPost409Response.md
12+
docs/CustomerPostRequest.md
13+
docs/GetResultsGet200Response.md
14+
git_push.sh
15+
go.mod
16+
go.sum
17+
model__customer_post_200_response.go
18+
model__customer_post_409_response.go
19+
model__customer_post_request.go
20+
model__get_results_get_200_response.go
21+
response.go
22+
test/api_customer_test.go
23+
utils.go

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.8.0

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: go
2+
3+
install:
4+
- go get -d -v .
5+
6+
script:
7+
- go build -v ./
8+

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Go API client for openapi
2+
3+
API's cerate customer in the database
4+
5+
## Overview
6+
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
7+
8+
- API version: 1.0.0
9+
- Package version: 1.0.0
10+
- Generator version: 7.8.0
11+
- Build package: org.openapitools.codegen.languages.GoClientCodegen
12+
13+
## Installation
14+
15+
Install the following dependencies:
16+
17+
```sh
18+
go get github.com/stretchr/testify/assert
19+
go get golang.org/x/net/context
20+
```
21+
22+
Put the package under your project folder and add the following in import:
23+
24+
```go
25+
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
26+
```
27+
28+
To use a proxy, set the environment variable `HTTP_PROXY`:
29+
30+
```go
31+
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
32+
```
33+
34+
## Configuration of Server URL
35+
36+
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
37+
38+
### Select Server Configuration
39+
40+
For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`.
41+
42+
```go
43+
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
44+
```
45+
46+
### Templated Server URL
47+
48+
Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`.
49+
50+
```go
51+
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
52+
"basePath": "v2",
53+
})
54+
```
55+
56+
Note, enum values are always validated and all unused variables are silently ignored.
57+
58+
### URLs Configuration per Operation
59+
60+
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
61+
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
62+
Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps.
63+
64+
```go
65+
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
66+
"{classname}Service.{nickname}": 2,
67+
})
68+
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
69+
"{classname}Service.{nickname}": {
70+
"port": "8443",
71+
},
72+
})
73+
```
74+
75+
## Documentation for API Endpoints
76+
77+
All URIs are relative to *http://localhost*
78+
79+
Class | Method | HTTP request | Description
80+
------------ | ------------- | ------------- | -------------
81+
*CustomerAPI* | [**CustomerPost**](docs/CustomerAPI.md#customerpost) | **Post** /customer | Create a new custmer in the database
82+
*CustomerAPI* | [**GetResultsGet**](docs/CustomerAPI.md#getresultsget) | **Get** /get-results | API to get counts of votes/ Winner of the election
83+
84+
85+
## Documentation For Models
86+
87+
- [CustomerPost200Response](docs/CustomerPost200Response.md)
88+
- [CustomerPost409Response](docs/CustomerPost409Response.md)
89+
- [CustomerPostRequest](docs/CustomerPostRequest.md)
90+
- [GetResultsGet200Response](docs/GetResultsGet200Response.md)
91+
92+
93+
## Documentation For Authorization
94+
95+
Endpoints do not require authorization.
96+
97+
98+
## Documentation for Utility Methods
99+
100+
Due to the fact that model structure members are all pointers, this package contains
101+
a number of utility functions to easily obtain pointers to values of basic types.
102+
Each of these functions takes a value of the given basic type and returns a pointer to it:
103+
104+
* `PtrBool`
105+
* `PtrInt`
106+
* `PtrInt32`
107+
* `PtrInt64`
108+
* `PtrFloat`
109+
* `PtrFloat32`
110+
* `PtrFloat64`
111+
* `PtrString`
112+
* `PtrTime`
113+
114+
## Author
115+
116+
sharmavivek1709@gmail.com
117+

api/openapi.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
openapi: 3.0.0
2+
info:
3+
contact:
4+
email: sharmavivek1709@gmail.com
5+
name: Vivek Sharma
6+
description: API's cerate customer in the database
7+
title: Customer Creation API
8+
version: 1.0.0
9+
servers:
10+
- url: /
11+
tags:
12+
- description: Operations related to Customer
13+
name: Customer
14+
paths:
15+
/customer:
16+
post:
17+
requestBody:
18+
content:
19+
application/json:
20+
example:
21+
email: vivek@gmail.com
22+
name: vviveksharma
23+
plan: Pro Plan
24+
algorithm: RSA
25+
platform: Linux
26+
schema:
27+
$ref: '#/components/schemas/_customer_post_request'
28+
description: User login credentials
29+
required: true
30+
responses:
31+
"200":
32+
content:
33+
application/json:
34+
schema:
35+
$ref: '#/components/schemas/_customer_post_200_response'
36+
description: Successful registeration
37+
"409":
38+
content:
39+
application/json:
40+
schema:
41+
$ref: '#/components/schemas/_customer_post_409_response'
42+
description: CONFLICT (User already exists)
43+
summary: Create a new custmer in the database
44+
tags:
45+
- Customer
46+
/get-results:
47+
get:
48+
parameters:
49+
- description: The search keyword
50+
explode: true
51+
in: query
52+
name: masterId
53+
required: true
54+
schema:
55+
type: string
56+
style: form
57+
responses:
58+
"200":
59+
content:
60+
application/json:
61+
schema:
62+
$ref: '#/components/schemas/_get_results_get_200_response'
63+
description: Success
64+
summary: API to get counts of votes/ Winner of the election
65+
tags:
66+
- Customer
67+
components:
68+
schemas:
69+
_customer_post_200_response:
70+
example:
71+
message: Customer added successfully with email user@example.com
72+
properties:
73+
message:
74+
example: Customer added successfully with email user@example.com
75+
type: string
76+
type: object
77+
_customer_post_409_response:
78+
example:
79+
token: User already exists
80+
properties:
81+
token:
82+
example: User already exists
83+
type: string
84+
type: object
85+
_get_results_get_200_response:
86+
example:
87+
master_id: cd95d3a3-0ffb-4e24-9db9-4d5df3bb228d
88+
name: vviveksharma
89+
plan: RSA
90+
platform: Linux
91+
emai: vivek@gmail.com
92+
algorithm: RSA
93+
properties:
94+
emai:
95+
example: vivek@gmail.com
96+
type: string
97+
name:
98+
example: vviveksharma
99+
type: string
100+
plan:
101+
example: RSA
102+
type: string
103+
algorithm:
104+
example: RSA
105+
type: string
106+
platform:
107+
example: Linux
108+
type: string
109+
master_id:
110+
example: cd95d3a3-0ffb-4e24-9db9-4d5df3bb228d
111+
type: string
112+
type: object
113+
_customer_post_request:
114+
properties:
115+
email:
116+
type: string
117+
name:
118+
format: email
119+
type: string
120+
plan:
121+
type: string
122+
algorithm:
123+
type: string
124+
platform:
125+
type: string
126+
required:
127+
- algorithm
128+
- email
129+
- name
130+
- plan
131+
- platform
132+
type: object

0 commit comments

Comments
 (0)