├── .gitignore
├── LICENSE
├── README.md
├── action
└── action.go
├── example
├── clients
│ ├── go
│ │ ├── .gitignore
│ │ ├── .swagger-codegen-ignore
│ │ ├── .travis.yml
│ │ ├── README.md
│ │ ├── api
│ │ │ └── swagger.yaml
│ │ ├── api_greet.go
│ │ ├── api_user_api.go
│ │ ├── client.go
│ │ ├── configuration.go
│ │ ├── docs
│ │ │ ├── GreetApi.md
│ │ │ ├── LoginReq.md
│ │ │ ├── RegisterReq.md
│ │ │ ├── UserApiApi.md
│ │ │ ├── UserInfoReply.md
│ │ │ ├── UserInfoReq.md
│ │ │ ├── UserSearchReply.md
│ │ │ └── UserSearchReq.md
│ │ ├── git_push.sh
│ │ ├── model_login_req.go
│ │ ├── model_register_req.go
│ │ ├── model_user_info_reply.go
│ │ ├── model_user_info_req.go
│ │ ├── model_user_search_reply.go
│ │ ├── model_user_search_req.go
│ │ └── response.go
│ ├── javascript
│ │ ├── .swagger-codegen-ignore
│ │ ├── .travis.yml
│ │ ├── README.md
│ │ ├── docs
│ │ │ ├── GreetApi.md
│ │ │ ├── LoginReq.md
│ │ │ ├── RegisterReq.md
│ │ │ ├── UserApiApi.md
│ │ │ ├── UserInfoReply.md
│ │ │ ├── UserInfoReq.md
│ │ │ ├── UserSearchReply.md
│ │ │ └── UserSearchReq.md
│ │ ├── git_push.sh
│ │ ├── mocha.opts
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── ApiClient.js
│ │ │ ├── api
│ │ │ │ ├── GreetApi.js
│ │ │ │ └── UserApiApi.js
│ │ │ ├── index.js
│ │ │ └── model
│ │ │ │ ├── LoginReq.js
│ │ │ │ ├── RegisterReq.js
│ │ │ │ ├── UserInfoReply.js
│ │ │ │ ├── UserInfoReq.js
│ │ │ │ ├── UserSearchReply.js
│ │ │ │ └── UserSearchReq.js
│ │ └── test
│ │ │ ├── api
│ │ │ ├── GreetApi.spec.js
│ │ │ └── UserApiApi.spec.js
│ │ │ ├── assert-equals.js
│ │ │ └── model
│ │ │ ├── LoginReq.spec.js
│ │ │ ├── RegisterReq.spec.js
│ │ │ ├── UserInfoReply.spec.js
│ │ │ ├── UserInfoReq.spec.js
│ │ │ ├── UserSearchReply.spec.js
│ │ │ └── UserSearchReq.spec.js
│ └── php
│ │ ├── .swagger-codegen-ignore
│ │ └── SwaggerClient-php
│ │ ├── .php_cs
│ │ ├── .travis.yml
│ │ ├── README.md
│ │ ├── composer.json
│ │ ├── docs
│ │ ├── Api
│ │ │ ├── GreetApi.md
│ │ │ └── UserApiApi.md
│ │ └── Model
│ │ │ ├── LoginReq.md
│ │ │ ├── RegisterReq.md
│ │ │ ├── UserInfoReply.md
│ │ │ ├── UserInfoReq.md
│ │ │ ├── UserSearchReply.md
│ │ │ └── UserSearchReq.md
│ │ ├── git_push.sh
│ │ ├── lib
│ │ ├── Api
│ │ │ ├── GreetApi.php
│ │ │ └── UserApiApi.php
│ │ ├── ApiException.php
│ │ ├── Configuration.php
│ │ ├── HeaderSelector.php
│ │ ├── Model
│ │ │ ├── LoginReq.php
│ │ │ ├── ModelInterface.php
│ │ │ ├── RegisterReq.php
│ │ │ ├── UserInfoReply.php
│ │ │ ├── UserInfoReq.php
│ │ │ ├── UserSearchReply.php
│ │ │ └── UserSearchReq.php
│ │ └── ObjectSerializer.php
│ │ ├── phpunit.xml.dist
│ │ └── test
│ │ ├── Api
│ │ ├── GreetApiTest.php
│ │ └── UserApiApiTest.php
│ │ └── Model
│ │ ├── LoginReqTest.php
│ │ ├── RegisterReqTest.php
│ │ ├── UserInfoReplyTest.php
│ │ ├── UserInfoReqTest.php
│ │ ├── UserSearchReplyTest.php
│ │ └── UserSearchReqTest.php
├── generate-client.sh
├── generate.go
├── gozero
│ ├── main.go
│ ├── swagger.go
│ └── swagger.json
├── rest.swagger.json
├── swagger.json
├── sys
│ └── user.api
├── test.api
├── user.api
└── user.json
├── generate
├── entities.go
├── generate.go
└── parser.go
├── go.mod
├── go.sum
└── main.go
/.gitignore:
--------------------------------------------------------------------------------
1 | # temp ignore
2 | *.log
3 | *.cache
4 | *.diff
5 | *.patch
6 | *.tmp
7 |
8 | # system ignore
9 | .DS_Store
10 | Thumbs.db
11 | *.orig
12 |
13 | # idea ignore
14 | .idea/
15 | *.ipr
16 |
17 | #
18 | .swagger-codegen
19 | swagtest
20 | *.exe
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 zeromicro
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # goctl-swagger[已废弃]
2 |
3 | ## 废弃使用说明
4 |
5 | 由于长期无人维护,此插件将不推荐使用,考虑到大家需求,goctl 内置实现了一套比较完善的 swagger 生成功能,可以使用 goctl api swagger 替换,详情参考 https://go-zero.dev/docs/tutorials/cli/swagger
6 |
7 |
8 | ### 1. 编译goctl-swagger插件
9 |
10 | ```
11 | GOPROXY=https://goproxy.cn/,direct go install github.com/zeromicro/goctl-swagger@latest
12 | ```
13 |
14 | ### 2. 配置环境
15 |
16 | 将$GOPATH/bin中的goctl-swagger添加到环境变量
17 |
18 | ### 3. 使用姿势
19 |
20 | * 创建api文件
21 |
22 | ```go
23 | info(
24 | title: "type title here"
25 | desc: "type desc here"
26 | author: "type author here"
27 | email: "type email here"
28 | version: "type version here"
29 | )
30 |
31 |
32 | type (
33 | RegisterReq {
34 | Username string `json:"username"`
35 | Password string `json:"password"`
36 | Mobile string `json:"mobile"`
37 | }
38 |
39 | LoginReq {
40 | Username string `json:"username"`
41 | Password string `json:"password"`
42 | }
43 |
44 | UserInfoReq {
45 | Id string `path:"id"`
46 | }
47 |
48 | UserInfoReply {
49 | Name string `json:"name"`
50 | Age int `json:"age"`
51 | Birthday string `json:"birthday"`
52 | Description string `json:"description"`
53 | Tag []string `json:"tag"`
54 | }
55 |
56 | UserSearchReq {
57 | KeyWord string `form:"keyWord"`
58 | }
59 | )
60 |
61 | service user-api {
62 | @doc(
63 | summary: "注册"
64 | )
65 | @handler register
66 | post /api/user/register (RegisterReq)
67 |
68 | @doc(
69 | summary: "登录"
70 | )
71 | @handler login
72 | post /api/user/login (LoginReq)
73 |
74 | @doc(
75 | summary: "获取用户信息"
76 | )
77 | @handler getUserInfo
78 | get /api/user/:id (UserInfoReq) returns (UserInfoReply)
79 |
80 | @doc(
81 | summary: "用户搜索"
82 | )
83 | @handler searchUser
84 | get /api/user/search (UserSearchReq) returns (UserInfoReply)
85 | }
86 | ```
87 |
88 | * 生成swagger.json 文件
89 |
90 | ```shell script
91 | goctl api plugin -plugin goctl-swagger="swagger -filename user.json" -api user.api -dir .
92 | ```
93 |
94 | * 指定Host,basePath,schemes [api-host-and-base-path](https://swagger.io/docs/specification/2-0/api-host-and-base-path/)
95 |
96 | ```shell script
97 | goctl api plugin -plugin goctl-swagger="swagger -filename user.json -host 127.0.0.2 -basepath /api -schemes https,wss" -api user.api -dir .
98 | ```
99 |
100 | * swagger ui 查看生成的文档
101 |
102 | ```shell script
103 | docker run --rm -p 8083:8080 -e SWAGGER_JSON=/foo/user.json -v $PWD:/foo swaggerapi/swagger-ui
104 | ```
105 |
106 | * Swagger Codegen 生成客户端调用代码(go,javascript,php)
107 |
108 | ```shell script
109 | for l in go javascript php; do
110 | docker run --rm -v "$(pwd):/go-work" swaggerapi/swagger-codegen-cli generate \
111 | -i "/go-work/rest.swagger.json" \
112 | -l "$l" \
113 | -o "/go-work/clients/$l"
114 | done
115 | ```
116 |
--------------------------------------------------------------------------------
/action/action.go:
--------------------------------------------------------------------------------
1 | package action
2 |
3 | import (
4 | "github.com/urfave/cli/v2"
5 | "github.com/zeromicro/go-zero/tools/goctl/plugin"
6 | "github.com/zeromicro/goctl-swagger/generate"
7 | )
8 |
9 | func Generator(ctx *cli.Context) error {
10 | fileName := ctx.String("filename")
11 |
12 | if len(fileName) == 0 {
13 | fileName = "rest.swagger.json"
14 | }
15 |
16 | p, err := plugin.NewPlugin()
17 | if err != nil {
18 | return err
19 | }
20 | basepath := ctx.String("basepath")
21 | host := ctx.String("host")
22 | schemes := ctx.String("schemes")
23 | return generate.Do(fileName, host, basepath, schemes, p)
24 | }
25 |
--------------------------------------------------------------------------------
/example/clients/go/.gitignore:
--------------------------------------------------------------------------------
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
25 |
--------------------------------------------------------------------------------
/example/clients/go/.swagger-codegen-ignore:
--------------------------------------------------------------------------------
1 | # Swagger Codegen Ignore
2 | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
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 Swagger Codgen 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
24 |
--------------------------------------------------------------------------------
/example/clients/go/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | install:
4 | - go get -d -v .
5 |
6 | script:
7 | - go build -v ./
8 |
9 |
--------------------------------------------------------------------------------
/example/clients/go/README.md:
--------------------------------------------------------------------------------
1 | # Go API client for swagger
2 |
3 | No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 |
5 | ## Overview
6 | This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
7 |
8 | - API version:
9 | - Package version: 1.0.0
10 | - Build package: io.swagger.codegen.languages.GoClientCodegen
11 |
12 | ## Installation
13 | Put the package under your project folder and add the following in import:
14 | ```golang
15 | import "./swagger"
16 | ```
17 |
18 | ## Documentation for API Endpoints
19 |
20 | All URIs are relative to *http://localhost*
21 |
22 | Class | Method | HTTP request | Description
23 | ------------ | ------------- | ------------- | -------------
24 | *GreetApi* | [**Ping**](docs/GreetApi.md#ping) | **Get** /user/ping |
25 | *UserApiApi* | [**GetUserInfo**](docs/UserApiApi.md#getuserinfo) | **Get** /api/user/{id} | 获取用户信息
26 | *UserApiApi* | [**Login**](docs/UserApiApi.md#login) | **Post** /api/user/login | 登录
27 | *UserApiApi* | [**Register**](docs/UserApiApi.md#register) | **Post** /api/user/register | 注册
28 | *UserApiApi* | [**SearchUser**](docs/UserApiApi.md#searchuser) | **Get** /api/user/search | 用户搜索
29 |
30 |
31 | ## Documentation For Models
32 |
33 | - [LoginReq](docs/LoginReq.md)
34 | - [RegisterReq](docs/RegisterReq.md)
35 | - [UserInfoReply](docs/UserInfoReply.md)
36 | - [UserInfoReq](docs/UserInfoReq.md)
37 | - [UserSearchReply](docs/UserSearchReply.md)
38 | - [UserSearchReq](docs/UserSearchReq.md)
39 |
40 |
41 | ## Documentation For Authorization
42 |
43 | ## apiKey
44 | - **Type**: API key
45 |
46 | Example
47 | ```golang
48 | auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
49 | Key: "APIKEY",
50 | Prefix: "Bearer", // Omit if not necessary.
51 | })
52 | r, err := client.Service.Operation(auth, args)
53 | ```
54 |
55 | ## Author
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/example/clients/go/api/swagger.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | swagger: "2.0"
3 | info:
4 | version: ""
5 | title: ""
6 | schemes:
7 | - "http"
8 | - "https"
9 | consumes:
10 | - "application/json"
11 | produces:
12 | - "application/json"
13 | paths:
14 | /api/user/login:
15 | post:
16 | tags:
17 | - "user-api"
18 | summary: "登录"
19 | operationId: "login"
20 | parameters:
21 | - in: "body"
22 | name: "body"
23 | required: true
24 | schema:
25 | $ref: "#/definitions/LoginReq"
26 | x-exportParamName: "Body"
27 | responses:
28 | "200":
29 | description: "A successful response."
30 | schema: {}
31 | /api/user/register:
32 | post:
33 | tags:
34 | - "user-api"
35 | summary: "注册"
36 | description: "注册一个用户"
37 | operationId: "register"
38 | parameters:
39 | - in: "body"
40 | name: "body"
41 | required: true
42 | schema:
43 | $ref: "#/definitions/RegisterReq"
44 | x-exportParamName: "Body"
45 | responses:
46 | "200":
47 | description: "A successful response."
48 | schema: {}
49 | /api/user/search:
50 | get:
51 | tags:
52 | - "user-api"
53 | summary: "用户搜索"
54 | operationId: "searchUser"
55 | parameters:
56 | - in: "body"
57 | name: "body"
58 | required: true
59 | schema:
60 | $ref: "#/definitions/UserSearchReq"
61 | x-exportParamName: "Body"
62 | responses:
63 | "200":
64 | description: "A successful response."
65 | schema:
66 | $ref: "#/definitions/UserSearchReply"
67 | /api/user/{id}:
68 | get:
69 | tags:
70 | - "user-api"
71 | summary: "获取用户信息"
72 | operationId: "getUserInfo"
73 | parameters:
74 | - name: "id"
75 | in: "path"
76 | required: true
77 | type: "string"
78 | x-exportParamName: "Id"
79 | - in: "body"
80 | name: "body"
81 | required: true
82 | schema:
83 | $ref: "#/definitions/UserInfoReq"
84 | x-exportParamName: "Body"
85 | responses:
86 | "200":
87 | description: "A successful response."
88 | schema:
89 | $ref: "#/definitions/UserInfoReply"
90 | /user/ping:
91 | get:
92 | tags:
93 | - "greet"
94 | operationId: "ping"
95 | parameters: []
96 | responses:
97 | "200":
98 | description: "A successful response."
99 | schema: {}
100 | securityDefinitions:
101 | apiKey:
102 | description: "Enter JWT Bearer token **_only_**"
103 | type: "apiKey"
104 | name: "Authorization"
105 | in: "header"
106 | definitions:
107 | LoginReq:
108 | type: "object"
109 | properties:
110 | username:
111 | type: "string"
112 | password:
113 | type: "string"
114 | title: "LoginReq"
115 | example:
116 | password: "password"
117 | username: "username"
118 | RegisterReq:
119 | type: "object"
120 | properties:
121 | username:
122 | type: "string"
123 | password:
124 | type: "string"
125 | mobile:
126 | type: "string"
127 | title: "RegisterReq"
128 | example:
129 | password: "password"
130 | mobile: "mobile"
131 | username: "username"
132 | UserInfoReply:
133 | type: "object"
134 | properties:
135 | name:
136 | type: "string"
137 | age:
138 | type: "integer"
139 | format: "int32"
140 | birthday:
141 | type: "string"
142 | description:
143 | type: "string"
144 | tag:
145 | type: "array"
146 | items:
147 | type: "string"
148 | title: "UserInfoReply"
149 | example:
150 | birthday: "birthday"
151 | name: "name"
152 | description: "description"
153 | tag:
154 | - "tag"
155 | - "tag"
156 | age: 0
157 | UserInfoReq:
158 | type: "object"
159 | properties:
160 | id:
161 | type: "string"
162 | title: "UserInfoReq"
163 | example:
164 | id: "id"
165 | UserSearchReply:
166 | type: "object"
167 | properties:
168 | KeyWord:
169 | type: "array"
170 | items:
171 | $ref: "#/definitions/UserInfoReply"
172 | title: "UserSearchReply"
173 | example:
174 | KeyWord:
175 | - birthday: "birthday"
176 | name: "name"
177 | description: "description"
178 | tag:
179 | - "tag"
180 | - "tag"
181 | age: 0
182 | - birthday: "birthday"
183 | name: "name"
184 | description: "description"
185 | tag:
186 | - "tag"
187 | - "tag"
188 | age: 0
189 | UserSearchReq:
190 | type: "object"
191 | properties:
192 | keyWord:
193 | type: "string"
194 | title: "UserSearchReq"
195 | example:
196 | keyWord: "keyWord"
197 |
--------------------------------------------------------------------------------
/example/clients/go/api_greet.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | import (
13 | "context"
14 | "io/ioutil"
15 | "net/http"
16 | "net/url"
17 | "strings"
18 | )
19 |
20 | // Linger please
21 | var (
22 | _ context.Context
23 | )
24 |
25 | type GreetApiService service
26 |
27 | /*
28 | GreetApiService
29 | * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
30 |
31 | @return interface{}
32 | */
33 | func (a *GreetApiService) Ping(ctx context.Context) (interface{}, *http.Response, error) {
34 | var (
35 | localVarHttpMethod = strings.ToUpper("Get")
36 | localVarPostBody interface{}
37 | localVarFileName string
38 | localVarFileBytes []byte
39 | localVarReturnValue interface{}
40 | )
41 |
42 | // create path and map variables
43 | localVarPath := a.client.cfg.BasePath + "/user/ping"
44 |
45 | localVarHeaderParams := make(map[string]string)
46 | localVarQueryParams := url.Values{}
47 | localVarFormParams := url.Values{}
48 |
49 | // to determine the Content-Type header
50 | localVarHttpContentTypes := []string{"application/json"}
51 |
52 | // set Content-Type header
53 | localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
54 | if localVarHttpContentType != "" {
55 | localVarHeaderParams["Content-Type"] = localVarHttpContentType
56 | }
57 |
58 | // to determine the Accept header
59 | localVarHttpHeaderAccepts := []string{"application/json"}
60 |
61 | // set Accept header
62 | localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
63 | if localVarHttpHeaderAccept != "" {
64 | localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
65 | }
66 | r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
67 | if err != nil {
68 | return localVarReturnValue, nil, err
69 | }
70 |
71 | localVarHttpResponse, err := a.client.callAPI(r)
72 | if err != nil || localVarHttpResponse == nil {
73 | return localVarReturnValue, localVarHttpResponse, err
74 | }
75 |
76 | localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
77 | localVarHttpResponse.Body.Close()
78 | if err != nil {
79 | return localVarReturnValue, localVarHttpResponse, err
80 | }
81 |
82 | if localVarHttpResponse.StatusCode < 300 {
83 | // If we succeed, return the data, otherwise pass on to decode error.
84 | err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
85 | return localVarReturnValue, localVarHttpResponse, err
86 | }
87 |
88 | if localVarHttpResponse.StatusCode >= 300 {
89 | newErr := GenericSwaggerError{
90 | body: localVarBody,
91 | error: localVarHttpResponse.Status,
92 | }
93 |
94 | if localVarHttpResponse.StatusCode == 200 {
95 | var v interface{}
96 | err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
97 | if err != nil {
98 | newErr.error = err.Error()
99 | return localVarReturnValue, localVarHttpResponse, newErr
100 | }
101 | newErr.model = v
102 | return localVarReturnValue, localVarHttpResponse, newErr
103 | }
104 |
105 | return localVarReturnValue, localVarHttpResponse, newErr
106 | }
107 |
108 | return localVarReturnValue, localVarHttpResponse, nil
109 | }
110 |
--------------------------------------------------------------------------------
/example/clients/go/configuration.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | import (
13 | "net/http"
14 | )
15 |
16 | // contextKeys are used to identify the type of value in the context.
17 | // Since these are string, it is possible to get a short description of the
18 | // context key for logging and debugging using key.String().
19 |
20 | type contextKey string
21 |
22 | func (c contextKey) String() string {
23 | return "auth " + string(c)
24 | }
25 |
26 | var (
27 | // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
28 | ContextOAuth2 = contextKey("token")
29 |
30 | // ContextBasicAuth takes BasicAuth as authentication for the request.
31 | ContextBasicAuth = contextKey("basic")
32 |
33 | // ContextAccessToken takes a string oauth2 access token as authentication for the request.
34 | ContextAccessToken = contextKey("accesstoken")
35 |
36 | // ContextAPIKey takes an APIKey as authentication for the request
37 | ContextAPIKey = contextKey("apikey")
38 | )
39 |
40 | // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
41 | type BasicAuth struct {
42 | UserName string `json:"userName,omitempty"`
43 | Password string `json:"password,omitempty"`
44 | }
45 |
46 | // APIKey provides API key based authentication to a request passed via context using ContextAPIKey
47 | type APIKey struct {
48 | Key string
49 | Prefix string
50 | }
51 |
52 | type Configuration struct {
53 | BasePath string `json:"basePath,omitempty"`
54 | Host string `json:"host,omitempty"`
55 | Scheme string `json:"scheme,omitempty"`
56 | DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
57 | UserAgent string `json:"userAgent,omitempty"`
58 | HTTPClient *http.Client
59 | }
60 |
61 | func NewConfiguration() *Configuration {
62 | cfg := &Configuration{
63 | BasePath: "http://localhost",
64 | DefaultHeader: make(map[string]string),
65 | UserAgent: "Swagger-Codegen/1.0.0/go",
66 | }
67 | return cfg
68 | }
69 |
70 | func (c *Configuration) AddDefaultHeader(key string, value string) {
71 | c.DefaultHeader[key] = value
72 | }
73 |
--------------------------------------------------------------------------------
/example/clients/go/docs/GreetApi.md:
--------------------------------------------------------------------------------
1 | # \GreetApi
2 |
3 | All URIs are relative to *http://localhost*
4 |
5 | Method | HTTP request | Description
6 | ------------- | ------------- | -------------
7 | [**Ping**](GreetApi.md#Ping) | **Get** /user/ping |
8 |
9 |
10 | # **Ping**
11 | > interface{} Ping(ctx, )
12 |
13 |
14 | ### Required Parameters
15 | This endpoint does not need any parameter.
16 |
17 | ### Return type
18 |
19 | [**interface{}**](interface{}.md)
20 |
21 | ### Authorization
22 |
23 | No authorization required
24 |
25 | ### HTTP request headers
26 |
27 | - **Content-Type**: application/json
28 | - **Accept**: application/json
29 |
30 | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
31 |
32 |
--------------------------------------------------------------------------------
/example/clients/go/docs/LoginReq.md:
--------------------------------------------------------------------------------
1 | # LoginReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **Username** | **string** | | [optional] [default to null]
7 | **Password** | **string** | | [optional] [default to null]
8 |
9 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/clients/go/docs/RegisterReq.md:
--------------------------------------------------------------------------------
1 | # RegisterReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **Username** | **string** | | [optional] [default to null]
7 | **Password** | **string** | | [optional] [default to null]
8 | **Mobile** | **string** | | [optional] [default to null]
9 |
10 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/clients/go/docs/UserApiApi.md:
--------------------------------------------------------------------------------
1 | # \UserApiApi
2 |
3 | All URIs are relative to *http://localhost*
4 |
5 | Method | HTTP request | Description
6 | ------------- | ------------- | -------------
7 | [**GetUserInfo**](UserApiApi.md#GetUserInfo) | **Get** /api/user/{id} | 获取用户信息
8 | [**Login**](UserApiApi.md#Login) | **Post** /api/user/login | 登录
9 | [**Register**](UserApiApi.md#Register) | **Post** /api/user/register | 注册
10 | [**SearchUser**](UserApiApi.md#SearchUser) | **Get** /api/user/search | 用户搜索
11 |
12 |
13 | # **GetUserInfo**
14 | > UserInfoReply GetUserInfo(ctx, id, body)
15 | 获取用户信息
16 |
17 | ### Required Parameters
18 |
19 | Name | Type | Description | Notes
20 | ------------- | ------------- | ------------- | -------------
21 | **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
22 | **id** | **string**| |
23 | **body** | [**UserInfoReq**](UserInfoReq.md)| |
24 |
25 | ### Return type
26 |
27 | [**UserInfoReply**](UserInfoReply.md)
28 |
29 | ### Authorization
30 |
31 | No authorization required
32 |
33 | ### HTTP request headers
34 |
35 | - **Content-Type**: application/json
36 | - **Accept**: application/json
37 |
38 | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
39 |
40 | # **Login**
41 | > interface{} Login(ctx, body)
42 | 登录
43 |
44 | ### Required Parameters
45 |
46 | Name | Type | Description | Notes
47 | ------------- | ------------- | ------------- | -------------
48 | **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
49 | **body** | [**LoginReq**](LoginReq.md)| |
50 |
51 | ### Return type
52 |
53 | [**interface{}**](interface{}.md)
54 |
55 | ### Authorization
56 |
57 | No authorization required
58 |
59 | ### HTTP request headers
60 |
61 | - **Content-Type**: application/json
62 | - **Accept**: application/json
63 |
64 | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
65 |
66 | # **Register**
67 | > interface{} Register(ctx, body)
68 | 注册
69 |
70 | 注册一个用户
71 |
72 | ### Required Parameters
73 |
74 | Name | Type | Description | Notes
75 | ------------- | ------------- | ------------- | -------------
76 | **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
77 | **body** | [**RegisterReq**](RegisterReq.md)| |
78 |
79 | ### Return type
80 |
81 | [**interface{}**](interface{}.md)
82 |
83 | ### Authorization
84 |
85 | No authorization required
86 |
87 | ### HTTP request headers
88 |
89 | - **Content-Type**: application/json
90 | - **Accept**: application/json
91 |
92 | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
93 |
94 | # **SearchUser**
95 | > UserSearchReply SearchUser(ctx, body)
96 | 用户搜索
97 |
98 | ### Required Parameters
99 |
100 | Name | Type | Description | Notes
101 | ------------- | ------------- | ------------- | -------------
102 | **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
103 | **body** | [**UserSearchReq**](UserSearchReq.md)| |
104 |
105 | ### Return type
106 |
107 | [**UserSearchReply**](UserSearchReply.md)
108 |
109 | ### Authorization
110 |
111 | No authorization required
112 |
113 | ### HTTP request headers
114 |
115 | - **Content-Type**: application/json
116 | - **Accept**: application/json
117 |
118 | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
119 |
120 |
--------------------------------------------------------------------------------
/example/clients/go/docs/UserInfoReply.md:
--------------------------------------------------------------------------------
1 | # UserInfoReply
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **Name** | **string** | | [optional] [default to null]
7 | **Age** | **int32** | | [optional] [default to null]
8 | **Birthday** | **string** | | [optional] [default to null]
9 | **Description** | **string** | | [optional] [default to null]
10 | **Tag** | **[]string** | | [optional] [default to null]
11 |
12 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
13 |
14 |
15 |
--------------------------------------------------------------------------------
/example/clients/go/docs/UserInfoReq.md:
--------------------------------------------------------------------------------
1 | # UserInfoReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **Id** | **string** | | [optional] [default to null]
7 |
8 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/clients/go/docs/UserSearchReply.md:
--------------------------------------------------------------------------------
1 | # UserSearchReply
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **KeyWord** | [**[]UserInfoReply**](UserInfoReply.md) | | [optional] [default to null]
7 |
8 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/clients/go/docs/UserSearchReq.md:
--------------------------------------------------------------------------------
1 | # UserSearchReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **KeyWord** | **string** | | [optional] [default to null]
7 |
8 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/clients/go/git_push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3 | #
4 | # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
5 |
6 | git_user_id=$1
7 | git_repo_id=$2
8 | release_note=$3
9 |
10 | if [ "$git_user_id" = "" ]; then
11 | git_user_id="GIT_USER_ID"
12 | echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
13 | fi
14 |
15 | if [ "$git_repo_id" = "" ]; then
16 | git_repo_id="GIT_REPO_ID"
17 | echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
18 | fi
19 |
20 | if [ "$release_note" = "" ]; then
21 | release_note="Minor update"
22 | echo "[INFO] No command line input provided. Set \$release_note to $release_note"
23 | fi
24 |
25 | # Initialize the local directory as a Git repository
26 | git init
27 |
28 | # Adds the files in the local repository and stages them for commit.
29 | git add .
30 |
31 | # Commits the tracked changes and prepares them to be pushed to a remote repository.
32 | git commit -m "$release_note"
33 |
34 | # Sets the new remote
35 | git_remote=`git remote`
36 | if [ "$git_remote" = "" ]; then # git remote not defined
37 |
38 | if [ "$GIT_TOKEN" = "" ]; then
39 | echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
40 | git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
41 | else
42 | git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
43 | fi
44 |
45 | fi
46 |
47 | git pull origin master
48 |
49 | # Pushes (Forces) the changes in the local repository up to the remote repository
50 | echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
51 | git push origin master 2>&1 | grep -v 'To https'
52 |
53 |
--------------------------------------------------------------------------------
/example/clients/go/model_login_req.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | type LoginReq struct {
13 | Username string `json:"username,omitempty"`
14 | Password string `json:"password,omitempty"`
15 | }
16 |
--------------------------------------------------------------------------------
/example/clients/go/model_register_req.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | type RegisterReq struct {
13 | Username string `json:"username,omitempty"`
14 | Password string `json:"password,omitempty"`
15 | Mobile string `json:"mobile,omitempty"`
16 | }
17 |
--------------------------------------------------------------------------------
/example/clients/go/model_user_info_reply.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | type UserInfoReply struct {
13 | Name string `json:"name,omitempty"`
14 | Age int32 `json:"age,omitempty"`
15 | Birthday string `json:"birthday,omitempty"`
16 | Description string `json:"description,omitempty"`
17 | Tag []string `json:"tag,omitempty"`
18 | }
19 |
--------------------------------------------------------------------------------
/example/clients/go/model_user_info_req.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | type UserInfoReq struct {
13 | Id string `json:"id,omitempty"`
14 | }
15 |
--------------------------------------------------------------------------------
/example/clients/go/model_user_search_reply.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | type UserSearchReply struct {
13 | KeyWord []UserInfoReply `json:"KeyWord,omitempty"`
14 | }
15 |
--------------------------------------------------------------------------------
/example/clients/go/model_user_search_req.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | type UserSearchReq struct {
13 | KeyWord string `json:"keyWord,omitempty"`
14 | }
15 |
--------------------------------------------------------------------------------
/example/clients/go/response.go:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | *
4 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | *
6 | * API version:
7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8 | */
9 |
10 | package swagger
11 |
12 | import (
13 | "net/http"
14 | )
15 |
16 | type APIResponse struct {
17 | *http.Response `json:"-"`
18 | Message string `json:"message,omitempty"`
19 | // Operation is the name of the swagger operation.
20 | Operation string `json:"operation,omitempty"`
21 | // RequestURL is the request URL. This value is always available, even if the
22 | // embedded *http.Response is nil.
23 | RequestURL string `json:"url,omitempty"`
24 | // Method is the HTTP method used for the request. This value is always
25 | // available, even if the embedded *http.Response is nil.
26 | Method string `json:"method,omitempty"`
27 | // Payload holds the contents of the response body (which may be nil or empty).
28 | // This is provided here as the raw response.Body() reader will have already
29 | // been drained.
30 | Payload []byte `json:"-"`
31 | }
32 |
33 | func NewAPIResponse(r *http.Response) *APIResponse {
34 |
35 | response := &APIResponse{Response: r}
36 | return response
37 | }
38 |
39 | func NewAPIResponseWithError(errorMessage string) *APIResponse {
40 |
41 | response := &APIResponse{Message: errorMessage}
42 | return response
43 | }
44 |
--------------------------------------------------------------------------------
/example/clients/javascript/.swagger-codegen-ignore:
--------------------------------------------------------------------------------
1 | # Swagger Codegen Ignore
2 | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
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 Swagger Codgen 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
24 |
--------------------------------------------------------------------------------
/example/clients/javascript/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "6"
4 | - "6.1"
5 | - "5"
6 | - "5.11"
7 |
8 |
--------------------------------------------------------------------------------
/example/clients/javascript/README.md:
--------------------------------------------------------------------------------
1 | # swagger-js-client
2 |
3 | SwaggerJsClient - JavaScript client for swagger-js-client
4 | No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5 | This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
6 |
7 | - API version:
8 | - Package version: 1.0.0
9 | - Build package: io.swagger.codegen.languages.JavascriptClientCodegen
10 |
11 | ## Installation
12 |
13 | ### For [Node.js](https://nodejs.org/)
14 |
15 | #### npm
16 |
17 | To publish the library as a [npm](https://www.npmjs.com/),
18 | please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
19 |
20 | Then install it via:
21 |
22 | ```shell
23 | npm install swagger-js-client --save
24 | ```
25 |
26 | ##### Local development
27 |
28 | To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
29 | into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
30 |
31 | ```shell
32 | npm install
33 | ```
34 |
35 | Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
36 |
37 | ```shell
38 | npm link
39 | ```
40 |
41 | Finally, switch to the directory you want to use your swagger-js-client from, and run:
42 |
43 | ```shell
44 | npm link /path/to/
31 | * An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
32 | *
29 | * The index
module provides access to constructors for all the classes which comprise the public API.
30 | *
33 | * var SwaggerJsClient = require('index'); // See note below*.
34 | * var xxxSvc = new SwaggerJsClient.XxxApi(); // Allocate the API class we're going to use.
35 | * var yyyModel = new SwaggerJsClient.Yyy(); // Construct a model instance.
36 | * yyyModel.someProperty = 'someValue';
37 | * ...
38 | * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
39 | * ...
40 | *
41 | * *NOTE: For a top-level AMD script, use require(['index'], function(){...})
42 | * and put the application logic within the callback function.
43 | *
45 | * A non-AMD browser application (discouraged) might do something like this: 46 | *
47 | * var xxxSvc = new SwaggerJsClient.XxxApi(); // Allocate the API class we're going to use. 48 | * var yyy = new SwaggerJsClient.Yyy(); // Construct a model instance. 49 | * yyyModel.someProperty = 'someValue'; 50 | * ... 51 | * var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service. 52 | * ... 53 | *54 | * 55 | * @module index 56 | * @version 1.0.0 57 | */ 58 | var exports = { 59 | /** 60 | * The ApiClient constructor. 61 | * @property {module:ApiClient} 62 | */ 63 | ApiClient: ApiClient, 64 | /** 65 | * The LoginReq model constructor. 66 | * @property {module:model/LoginReq} 67 | */ 68 | LoginReq: LoginReq, 69 | /** 70 | * The RegisterReq model constructor. 71 | * @property {module:model/RegisterReq} 72 | */ 73 | RegisterReq: RegisterReq, 74 | /** 75 | * The UserInfoReply model constructor. 76 | * @property {module:model/UserInfoReply} 77 | */ 78 | UserInfoReply: UserInfoReply, 79 | /** 80 | * The UserInfoReq model constructor. 81 | * @property {module:model/UserInfoReq} 82 | */ 83 | UserInfoReq: UserInfoReq, 84 | /** 85 | * The UserSearchReply model constructor. 86 | * @property {module:model/UserSearchReply} 87 | */ 88 | UserSearchReply: UserSearchReply, 89 | /** 90 | * The UserSearchReq model constructor. 91 | * @property {module:model/UserSearchReq} 92 | */ 93 | UserSearchReq: UserSearchReq, 94 | /** 95 | * The GreetApi service constructor. 96 | * @property {module:api/GreetApi} 97 | */ 98 | GreetApi: GreetApi, 99 | /** 100 | * The UserApiApi service constructor. 101 | * @property {module:api/UserApiApi} 102 | */ 103 | UserApiApi: UserApiApi 104 | }; 105 | 106 | return exports; 107 | })); 108 | -------------------------------------------------------------------------------- /example/clients/javascript/src/model/LoginReq.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) 4 | * 5 | * OpenAPI spec version: 6 | * 7 | * NOTE: This class is auto generated by the swagger code generator program. 8 | * https://github.com/swagger-api/swagger-codegen.git 9 | * 10 | * Swagger Codegen version: 2.4.18 11 | * 12 | * Do not edit the class manually. 13 | * 14 | */ 15 | 16 | (function(root, factory) { 17 | if (typeof define === 'function' && define.amd) { 18 | // AMD. Register as an anonymous module. 19 | define(['ApiClient'], factory); 20 | } else if (typeof module === 'object' && module.exports) { 21 | // CommonJS-like environments that support module.exports, like Node. 22 | module.exports = factory(require('../ApiClient')); 23 | } else { 24 | // Browser globals (root is window) 25 | if (!root.SwaggerJsClient) { 26 | root.SwaggerJsClient = {}; 27 | } 28 | root.SwaggerJsClient.LoginReq = factory(root.SwaggerJsClient.ApiClient); 29 | } 30 | }(this, function(ApiClient) { 31 | 'use strict'; 32 | 33 | /** 34 | * The LoginReq model module. 35 | * @module model/LoginReq 36 | * @version 1.0.0 37 | */ 38 | 39 | /** 40 | * Constructs a new
LoginReq
.
41 | * @alias module:model/LoginReq
42 | * @class
43 | */
44 | var exports = function() {
45 | };
46 |
47 | /**
48 | * Constructs a LoginReq
from a plain JavaScript object, optionally creating a new instance.
49 | * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
50 | * @param {Object} data The plain JavaScript object bearing properties of interest.
51 | * @param {module:model/LoginReq} obj Optional instance to populate.
52 | * @return {module:model/LoginReq} The populated LoginReq
instance.
53 | */
54 | exports.constructFromObject = function(data, obj) {
55 | if (data) {
56 | obj = obj || new exports();
57 | if (data.hasOwnProperty('username'))
58 | obj.username = ApiClient.convertToType(data['username'], 'String');
59 | if (data.hasOwnProperty('password'))
60 | obj.password = ApiClient.convertToType(data['password'], 'String');
61 | }
62 | return obj;
63 | }
64 |
65 | /**
66 | * @member {String} username
67 | */
68 | exports.prototype.username = undefined;
69 |
70 | /**
71 | * @member {String} password
72 | */
73 | exports.prototype.password = undefined;
74 |
75 |
76 | return exports;
77 |
78 | }));
79 |
--------------------------------------------------------------------------------
/example/clients/javascript/src/model/RegisterReq.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD. Register as an anonymous module.
19 | define(['ApiClient'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | module.exports = factory(require('../ApiClient'));
23 | } else {
24 | // Browser globals (root is window)
25 | if (!root.SwaggerJsClient) {
26 | root.SwaggerJsClient = {};
27 | }
28 | root.SwaggerJsClient.RegisterReq = factory(root.SwaggerJsClient.ApiClient);
29 | }
30 | }(this, function(ApiClient) {
31 | 'use strict';
32 |
33 | /**
34 | * The RegisterReq model module.
35 | * @module model/RegisterReq
36 | * @version 1.0.0
37 | */
38 |
39 | /**
40 | * Constructs a new RegisterReq
.
41 | * @alias module:model/RegisterReq
42 | * @class
43 | */
44 | var exports = function() {
45 | };
46 |
47 | /**
48 | * Constructs a RegisterReq
from a plain JavaScript object, optionally creating a new instance.
49 | * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
50 | * @param {Object} data The plain JavaScript object bearing properties of interest.
51 | * @param {module:model/RegisterReq} obj Optional instance to populate.
52 | * @return {module:model/RegisterReq} The populated RegisterReq
instance.
53 | */
54 | exports.constructFromObject = function(data, obj) {
55 | if (data) {
56 | obj = obj || new exports();
57 | if (data.hasOwnProperty('username'))
58 | obj.username = ApiClient.convertToType(data['username'], 'String');
59 | if (data.hasOwnProperty('password'))
60 | obj.password = ApiClient.convertToType(data['password'], 'String');
61 | if (data.hasOwnProperty('mobile'))
62 | obj.mobile = ApiClient.convertToType(data['mobile'], 'String');
63 | }
64 | return obj;
65 | }
66 |
67 | /**
68 | * @member {String} username
69 | */
70 | exports.prototype.username = undefined;
71 |
72 | /**
73 | * @member {String} password
74 | */
75 | exports.prototype.password = undefined;
76 |
77 | /**
78 | * @member {String} mobile
79 | */
80 | exports.prototype.mobile = undefined;
81 |
82 |
83 | return exports;
84 |
85 | }));
86 |
--------------------------------------------------------------------------------
/example/clients/javascript/src/model/UserInfoReply.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD. Register as an anonymous module.
19 | define(['ApiClient'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | module.exports = factory(require('../ApiClient'));
23 | } else {
24 | // Browser globals (root is window)
25 | if (!root.SwaggerJsClient) {
26 | root.SwaggerJsClient = {};
27 | }
28 | root.SwaggerJsClient.UserInfoReply = factory(root.SwaggerJsClient.ApiClient);
29 | }
30 | }(this, function(ApiClient) {
31 | 'use strict';
32 |
33 | /**
34 | * The UserInfoReply model module.
35 | * @module model/UserInfoReply
36 | * @version 1.0.0
37 | */
38 |
39 | /**
40 | * Constructs a new UserInfoReply
.
41 | * @alias module:model/UserInfoReply
42 | * @class
43 | */
44 | var exports = function() {
45 | };
46 |
47 | /**
48 | * Constructs a UserInfoReply
from a plain JavaScript object, optionally creating a new instance.
49 | * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
50 | * @param {Object} data The plain JavaScript object bearing properties of interest.
51 | * @param {module:model/UserInfoReply} obj Optional instance to populate.
52 | * @return {module:model/UserInfoReply} The populated UserInfoReply
instance.
53 | */
54 | exports.constructFromObject = function(data, obj) {
55 | if (data) {
56 | obj = obj || new exports();
57 | if (data.hasOwnProperty('name'))
58 | obj.name = ApiClient.convertToType(data['name'], 'String');
59 | if (data.hasOwnProperty('age'))
60 | obj.age = ApiClient.convertToType(data['age'], 'Number');
61 | if (data.hasOwnProperty('birthday'))
62 | obj.birthday = ApiClient.convertToType(data['birthday'], 'String');
63 | if (data.hasOwnProperty('description'))
64 | obj.description = ApiClient.convertToType(data['description'], 'String');
65 | if (data.hasOwnProperty('tag'))
66 | obj.tag = ApiClient.convertToType(data['tag'], ['String']);
67 | }
68 | return obj;
69 | }
70 |
71 | /**
72 | * @member {String} name
73 | */
74 | exports.prototype.name = undefined;
75 |
76 | /**
77 | * @member {Number} age
78 | */
79 | exports.prototype.age = undefined;
80 |
81 | /**
82 | * @member {String} birthday
83 | */
84 | exports.prototype.birthday = undefined;
85 |
86 | /**
87 | * @member {String} description
88 | */
89 | exports.prototype.description = undefined;
90 |
91 | /**
92 | * @member {Array.UserInfoReq
.
41 | * @alias module:model/UserInfoReq
42 | * @class
43 | */
44 | var exports = function() {
45 | };
46 |
47 | /**
48 | * Constructs a UserInfoReq
from a plain JavaScript object, optionally creating a new instance.
49 | * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
50 | * @param {Object} data The plain JavaScript object bearing properties of interest.
51 | * @param {module:model/UserInfoReq} obj Optional instance to populate.
52 | * @return {module:model/UserInfoReq} The populated UserInfoReq
instance.
53 | */
54 | exports.constructFromObject = function(data, obj) {
55 | if (data) {
56 | obj = obj || new exports();
57 | if (data.hasOwnProperty('id'))
58 | obj.id = ApiClient.convertToType(data['id'], 'String');
59 | }
60 | return obj;
61 | }
62 |
63 | /**
64 | * @member {String} id
65 | */
66 | exports.prototype.id = undefined;
67 |
68 |
69 | return exports;
70 |
71 | }));
72 |
--------------------------------------------------------------------------------
/example/clients/javascript/src/model/UserSearchReply.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD. Register as an anonymous module.
19 | define(['ApiClient', 'model/UserInfoReply'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | module.exports = factory(require('../ApiClient'), require('./UserInfoReply'));
23 | } else {
24 | // Browser globals (root is window)
25 | if (!root.SwaggerJsClient) {
26 | root.SwaggerJsClient = {};
27 | }
28 | root.SwaggerJsClient.UserSearchReply = factory(root.SwaggerJsClient.ApiClient, root.SwaggerJsClient.UserInfoReply);
29 | }
30 | }(this, function(ApiClient, UserInfoReply) {
31 | 'use strict';
32 |
33 | /**
34 | * The UserSearchReply model module.
35 | * @module model/UserSearchReply
36 | * @version 1.0.0
37 | */
38 |
39 | /**
40 | * Constructs a new UserSearchReply
.
41 | * @alias module:model/UserSearchReply
42 | * @class
43 | */
44 | var exports = function() {
45 | };
46 |
47 | /**
48 | * Constructs a UserSearchReply
from a plain JavaScript object, optionally creating a new instance.
49 | * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
50 | * @param {Object} data The plain JavaScript object bearing properties of interest.
51 | * @param {module:model/UserSearchReply} obj Optional instance to populate.
52 | * @return {module:model/UserSearchReply} The populated UserSearchReply
instance.
53 | */
54 | exports.constructFromObject = function(data, obj) {
55 | if (data) {
56 | obj = obj || new exports();
57 | if (data.hasOwnProperty('KeyWord'))
58 | obj.keyWord = ApiClient.convertToType(data['KeyWord'], [UserInfoReply]);
59 | }
60 | return obj;
61 | }
62 |
63 | /**
64 | * @member {Array.UserSearchReq
.
41 | * @alias module:model/UserSearchReq
42 | * @class
43 | */
44 | var exports = function() {
45 | };
46 |
47 | /**
48 | * Constructs a UserSearchReq
from a plain JavaScript object, optionally creating a new instance.
49 | * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
50 | * @param {Object} data The plain JavaScript object bearing properties of interest.
51 | * @param {module:model/UserSearchReq} obj Optional instance to populate.
52 | * @return {module:model/UserSearchReq} The populated UserSearchReq
instance.
53 | */
54 | exports.constructFromObject = function(data, obj) {
55 | if (data) {
56 | obj = obj || new exports();
57 | if (data.hasOwnProperty('keyWord'))
58 | obj.keyWord = ApiClient.convertToType(data['keyWord'], 'String');
59 | }
60 | return obj;
61 | }
62 |
63 | /**
64 | * @member {String} keyWord
65 | */
66 | exports.prototype.keyWord = undefined;
67 |
68 |
69 | return exports;
70 |
71 | }));
72 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/api/GreetApi.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | beforeEach(function() {
33 | instance = new SwaggerJsClient.GreetApi();
34 | });
35 |
36 | describe('(package)', function() {
37 | describe('GreetApi', function() {
38 | describe('ping', function() {
39 | it('should call ping successfully', function(done) {
40 | // TODO: uncomment ping call and complete the assertions
41 | /*
42 |
43 | instance.ping(function(error, data, response) {
44 | if (error) {
45 | done(error);
46 | return;
47 | }
48 | // TODO: update response assertions
49 | expect(data).to.be.a(Object);
50 | // expect(data).to.be(null);
51 |
52 | done();
53 | });
54 | */
55 | // TODO: uncomment and complete method invocation above, then delete this line and the next:
56 | done();
57 | });
58 | });
59 | });
60 | });
61 |
62 | }));
63 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/api/UserApiApi.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | beforeEach(function() {
33 | instance = new SwaggerJsClient.UserApiApi();
34 | });
35 |
36 | describe('(package)', function() {
37 | describe('UserApiApi', function() {
38 | describe('getUserInfo', function() {
39 | it('should call getUserInfo successfully', function(done) {
40 | // TODO: uncomment, update parameter values for getUserInfo call and complete the assertions
41 | /*
42 | var id = "id_example";
43 | var body = new SwaggerJsClient.UserInfoReq();
44 | body.id = "";
45 |
46 | instance.getUserInfo(id, body, function(error, data, response) {
47 | if (error) {
48 | done(error);
49 | return;
50 | }
51 | // TODO: update response assertions
52 | expect(data).to.be.a(SwaggerJsClient.UserInfoReply);
53 | expect(data.name).to.be.a('string');
54 | expect(data.name).to.be("");
55 | expect(data.age).to.be.a('number');
56 | expect(data.age).to.be(0);
57 | expect(data.birthday).to.be.a('string');
58 | expect(data.birthday).to.be("");
59 | expect(data.description).to.be.a('string');
60 | expect(data.description).to.be("");
61 | {
62 | let dataCtr = data.tag;
63 | expect(dataCtr).to.be.an(Array);
64 | expect(dataCtr).to.not.be.empty();
65 | for (let p in dataCtr) {
66 | let data = dataCtr[p];
67 | expect(data).to.be.a('string');
68 | expect(data).to.be("");
69 | }
70 | }
71 |
72 | done();
73 | });
74 | */
75 | // TODO: uncomment and complete method invocation above, then delete this line and the next:
76 | done();
77 | });
78 | });
79 | describe('login', function() {
80 | it('should call login successfully', function(done) {
81 | // TODO: uncomment, update parameter values for login call and complete the assertions
82 | /*
83 | var body = new SwaggerJsClient.LoginReq();
84 | body.username = "";
85 | body.password = "";
86 |
87 | instance.login(body, function(error, data, response) {
88 | if (error) {
89 | done(error);
90 | return;
91 | }
92 | // TODO: update response assertions
93 | expect(data).to.be.a(Object);
94 | // expect(data).to.be(null);
95 |
96 | done();
97 | });
98 | */
99 | // TODO: uncomment and complete method invocation above, then delete this line and the next:
100 | done();
101 | });
102 | });
103 | describe('register', function() {
104 | it('should call register successfully', function(done) {
105 | // TODO: uncomment, update parameter values for register call and complete the assertions
106 | /*
107 | var body = new SwaggerJsClient.RegisterReq();
108 | body.username = "";
109 | body.password = "";
110 | body.mobile = "";
111 |
112 | instance.register(body, function(error, data, response) {
113 | if (error) {
114 | done(error);
115 | return;
116 | }
117 | // TODO: update response assertions
118 | expect(data).to.be.a(Object);
119 | // expect(data).to.be(null);
120 |
121 | done();
122 | });
123 | */
124 | // TODO: uncomment and complete method invocation above, then delete this line and the next:
125 | done();
126 | });
127 | });
128 | describe('searchUser', function() {
129 | it('should call searchUser successfully', function(done) {
130 | // TODO: uncomment, update parameter values for searchUser call and complete the assertions
131 | /*
132 | var body = new SwaggerJsClient.UserSearchReq();
133 | body.keyWord = "";
134 |
135 | instance.searchUser(body, function(error, data, response) {
136 | if (error) {
137 | done(error);
138 | return;
139 | }
140 | // TODO: update response assertions
141 | expect(data).to.be.a(SwaggerJsClient.UserSearchReply);
142 | {
143 | let dataCtr = data.keyWord;
144 | expect(dataCtr).to.be.an(Array);
145 | expect(dataCtr).to.not.be.empty();
146 | for (let p in dataCtr) {
147 | let data = dataCtr[p];
148 | expect(data).to.be.a(SwaggerJsClient.UserInfoReply);
149 | expect(data.name).to.be.a('string');
150 | expect(data.name).to.be("");
151 | expect(data.age).to.be.a('number');
152 | expect(data.age).to.be(0);
153 | expect(data.birthday).to.be.a('string');
154 | expect(data.birthday).to.be("");
155 | expect(data.description).to.be.a('string');
156 | expect(data.description).to.be("");
157 | {
158 | let dataCtr = data.tag;
159 | expect(dataCtr).to.be.an(Array);
160 | expect(dataCtr).to.not.be.empty();
161 | for (let p in dataCtr) {
162 | let data = dataCtr[p];
163 | expect(data).to.be.a('string');
164 | expect(data).to.be("");
165 | }
166 | }
167 |
168 | }
169 | }
170 |
171 | done();
172 | });
173 | */
174 | // TODO: uncomment and complete method invocation above, then delete this line and the next:
175 | done();
176 | });
177 | });
178 | });
179 | });
180 |
181 | }));
182 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/assert-equals.js:
--------------------------------------------------------------------------------
1 | (function(root, factory) {
2 | if (typeof define === 'function' && define.amd) {
3 | // AMD.
4 | define(factory);
5 | } else if (typeof module === 'object' && module.exports) {
6 | // CommonJS-like environments that support module.exports, like Node.
7 | module.exports = factory();
8 | } else {
9 | // Browser globals (root is window)
10 | root.assertEquals = factory();
11 | }
12 | }(this, function() {
13 | 'use strict';
14 |
15 | var assertEquals = function(expected, actual, ptr) {
16 | if (!ptr)
17 | ptr = "";
18 | if (actual === expected)
19 | return;
20 | if (expected instanceof Date || actual instanceof Date) {
21 | expected = toISODateString(expected);
22 | actual = toISODateString(actual);
23 | if (actual !== expected)
24 | fail(expected, actual, ptr, "date value incorrect;");
25 | }
26 | if (!expected || !actual || typeof expected != 'object' && typeof actual != 'object') {
27 | if (typeof actual != typeof expected)
28 | fail(typeof expected, typeof actual, ptr, "value type incorrect;");
29 | if (actual != expected)
30 | fail(expected, actual, ptr, "value incorrect;");
31 | }
32 | return checkObject(expected, actual, ptr);
33 | }
34 |
35 | function toISODateString(value) {
36 | if (value instanceof Date) {
37 | // JavaScript's ISO string contains a milliseconds component that must be stripped out.
38 | value = value.toISOString().replace('.000', '');
39 | }
40 | return value;
41 | }
42 |
43 | function checkObject(expected, actual, ptr) {
44 | if (undefOrNull(expected) || undefOrNull(actual))
45 | fail(expected, actual, ptr, "missing value;");
46 | if (typeof expected !== typeof actual)
47 | fail(typeof expected, typeof actual, ptr, "wrong type;");
48 | if (expected.prototype !== actual.prototype)
49 | fail(expected.prototype, actual.prototype, ptr, "wrong prototype;");
50 | try {
51 | var expectedKeys = Object.keys(expected);
52 | var actualKeys = Object.keys(actual);
53 | } catch (e) {
54 | fail(expectedKeys, actualKeys, ptr, "wrong keys;");
55 | }
56 | if (actualKeys.length != expectedKeys.length)
57 | fail(expectedKeys.length, actualKeys.length, ptr, "key count incorrect;");
58 | expectedKeys.sort();
59 | actualKeys.sort();
60 | for (var i = 0; i < expectedKeys.length; i++) {
61 | if (actualKeys[i] != expectedKeys[i])
62 | fail(expectedKeys, actualKeys, ptr, "wrong keys;");
63 | }
64 | for (i = 0; i < expectedKeys.length; i++) {
65 | var key = expectedKeys[i];
66 | assertEquals(expected[key], actual[key], ptr + '/' + key);
67 | }
68 | }
69 |
70 | function undefOrNull(v) {
71 | return v === undefined || v === null;
72 | }
73 |
74 | function fail(expected, actual, ptr, msg) {
75 | var text = ptr + ' ' + msg + " expected: " + expected + ", actual: " + actual;
76 | console.log(text);
77 | throw new Error(text);
78 | }
79 |
80 | return assertEquals;
81 | }));
82 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/model/LoginReq.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | describe('(package)', function() {
33 | describe('LoginReq', function() {
34 | beforeEach(function() {
35 | instance = new SwaggerJsClient.LoginReq();
36 | });
37 |
38 | it('should create an instance of LoginReq', function() {
39 | // TODO: update the code to test LoginReq
40 | expect(instance).to.be.a(SwaggerJsClient.LoginReq);
41 | });
42 |
43 | it('should have the property username (base name: "username")', function() {
44 | // TODO: update the code to test the property username
45 | expect(instance).to.have.property('username');
46 | // expect(instance.username).to.be(expectedValueLiteral);
47 | });
48 |
49 | it('should have the property password (base name: "password")', function() {
50 | // TODO: update the code to test the property password
51 | expect(instance).to.have.property('password');
52 | // expect(instance.password).to.be(expectedValueLiteral);
53 | });
54 |
55 | });
56 | });
57 |
58 | }));
59 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/model/RegisterReq.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | describe('(package)', function() {
33 | describe('RegisterReq', function() {
34 | beforeEach(function() {
35 | instance = new SwaggerJsClient.RegisterReq();
36 | });
37 |
38 | it('should create an instance of RegisterReq', function() {
39 | // TODO: update the code to test RegisterReq
40 | expect(instance).to.be.a(SwaggerJsClient.RegisterReq);
41 | });
42 |
43 | it('should have the property username (base name: "username")', function() {
44 | // TODO: update the code to test the property username
45 | expect(instance).to.have.property('username');
46 | // expect(instance.username).to.be(expectedValueLiteral);
47 | });
48 |
49 | it('should have the property password (base name: "password")', function() {
50 | // TODO: update the code to test the property password
51 | expect(instance).to.have.property('password');
52 | // expect(instance.password).to.be(expectedValueLiteral);
53 | });
54 |
55 | it('should have the property mobile (base name: "mobile")', function() {
56 | // TODO: update the code to test the property mobile
57 | expect(instance).to.have.property('mobile');
58 | // expect(instance.mobile).to.be(expectedValueLiteral);
59 | });
60 |
61 | });
62 | });
63 |
64 | }));
65 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/model/UserInfoReply.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | describe('(package)', function() {
33 | describe('UserInfoReply', function() {
34 | beforeEach(function() {
35 | instance = new SwaggerJsClient.UserInfoReply();
36 | });
37 |
38 | it('should create an instance of UserInfoReply', function() {
39 | // TODO: update the code to test UserInfoReply
40 | expect(instance).to.be.a(SwaggerJsClient.UserInfoReply);
41 | });
42 |
43 | it('should have the property name (base name: "name")', function() {
44 | // TODO: update the code to test the property name
45 | expect(instance).to.have.property('name');
46 | // expect(instance.name).to.be(expectedValueLiteral);
47 | });
48 |
49 | it('should have the property age (base name: "age")', function() {
50 | // TODO: update the code to test the property age
51 | expect(instance).to.have.property('age');
52 | // expect(instance.age).to.be(expectedValueLiteral);
53 | });
54 |
55 | it('should have the property birthday (base name: "birthday")', function() {
56 | // TODO: update the code to test the property birthday
57 | expect(instance).to.have.property('birthday');
58 | // expect(instance.birthday).to.be(expectedValueLiteral);
59 | });
60 |
61 | it('should have the property description (base name: "description")', function() {
62 | // TODO: update the code to test the property description
63 | expect(instance).to.have.property('description');
64 | // expect(instance.description).to.be(expectedValueLiteral);
65 | });
66 |
67 | it('should have the property tag (base name: "tag")', function() {
68 | // TODO: update the code to test the property tag
69 | expect(instance).to.have.property('tag');
70 | // expect(instance.tag).to.be(expectedValueLiteral);
71 | });
72 |
73 | });
74 | });
75 |
76 | }));
77 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/model/UserInfoReq.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | describe('(package)', function() {
33 | describe('UserInfoReq', function() {
34 | beforeEach(function() {
35 | instance = new SwaggerJsClient.UserInfoReq();
36 | });
37 |
38 | it('should create an instance of UserInfoReq', function() {
39 | // TODO: update the code to test UserInfoReq
40 | expect(instance).to.be.a(SwaggerJsClient.UserInfoReq);
41 | });
42 |
43 | it('should have the property id (base name: "id")', function() {
44 | // TODO: update the code to test the property id
45 | expect(instance).to.have.property('id');
46 | // expect(instance.id).to.be(expectedValueLiteral);
47 | });
48 |
49 | });
50 | });
51 |
52 | }));
53 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/model/UserSearchReply.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | describe('(package)', function() {
33 | describe('UserSearchReply', function() {
34 | beforeEach(function() {
35 | instance = new SwaggerJsClient.UserSearchReply();
36 | });
37 |
38 | it('should create an instance of UserSearchReply', function() {
39 | // TODO: update the code to test UserSearchReply
40 | expect(instance).to.be.a(SwaggerJsClient.UserSearchReply);
41 | });
42 |
43 | it('should have the property keyWord (base name: "KeyWord")', function() {
44 | // TODO: update the code to test the property keyWord
45 | expect(instance).to.have.property('keyWord');
46 | // expect(instance.keyWord).to.be(expectedValueLiteral);
47 | });
48 |
49 | });
50 | });
51 |
52 | }));
53 |
--------------------------------------------------------------------------------
/example/clients/javascript/test/model/UserSearchReq.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version:
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 2.4.18
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 |
16 | (function(root, factory) {
17 | if (typeof define === 'function' && define.amd) {
18 | // AMD.
19 | define(['expect.js', '../../src/index'], factory);
20 | } else if (typeof module === 'object' && module.exports) {
21 | // CommonJS-like environments that support module.exports, like Node.
22 | factory(require('expect.js'), require('../../src/index'));
23 | } else {
24 | // Browser globals (root is window)
25 | factory(root.expect, root.SwaggerJsClient);
26 | }
27 | }(this, function(expect, SwaggerJsClient) {
28 | 'use strict';
29 |
30 | var instance;
31 |
32 | describe('(package)', function() {
33 | describe('UserSearchReq', function() {
34 | beforeEach(function() {
35 | instance = new SwaggerJsClient.UserSearchReq();
36 | });
37 |
38 | it('should create an instance of UserSearchReq', function() {
39 | // TODO: update the code to test UserSearchReq
40 | expect(instance).to.be.a(SwaggerJsClient.UserSearchReq);
41 | });
42 |
43 | it('should have the property keyWord (base name: "keyWord")', function() {
44 | // TODO: update the code to test the property keyWord
45 | expect(instance).to.have.property('keyWord');
46 | // expect(instance.keyWord).to.be(expectedValueLiteral);
47 | });
48 |
49 | });
50 | });
51 |
52 | }));
53 |
--------------------------------------------------------------------------------
/example/clients/php/.swagger-codegen-ignore:
--------------------------------------------------------------------------------
1 | # Swagger Codegen Ignore
2 | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
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 Swagger Codgen 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
24 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/.php_cs:
--------------------------------------------------------------------------------
1 | setUsingCache(true)
5 | ->setRules([
6 | '@PSR2' => true,
7 | 'ordered_imports' => true,
8 | 'phpdoc_order' => true,
9 | 'array_syntax' => [ 'syntax' => 'short' ],
10 | 'strict_comparison' => true,
11 | 'strict_param' => true,
12 | 'no_trailing_whitespace' => false,
13 | 'no_trailing_whitespace_in_comment' => false,
14 | 'braces' => false,
15 | 'single_blank_line_at_eof' => false,
16 | 'blank_line_after_namespace' => false,
17 | ])
18 | ->setFinder(
19 | PhpCsFixer\Finder::create()
20 | ->exclude('test')
21 | ->exclude('tests')
22 | ->in(__DIR__)
23 | );
24 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 | sudo: false
3 | php:
4 | - 5.4
5 | - 5.5
6 | - 5.6
7 | - 7.0
8 | - hhvm
9 | before_install: "composer install"
10 | script: "vendor/bin/phpunit"
11 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/README.md:
--------------------------------------------------------------------------------
1 | # SwaggerClient-php
2 | No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
3 |
4 | This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
5 |
6 | - API version:
7 | - Build package: io.swagger.codegen.languages.PhpClientCodegen
8 |
9 | ## Requirements
10 |
11 | PHP 5.5 and later
12 |
13 | ## Installation & Usage
14 | ### Composer
15 |
16 | To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
17 |
18 | ```
19 | {
20 | "repositories": [
21 | {
22 | "type": "git",
23 | "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
24 | }
25 | ],
26 | "require": {
27 | "GIT_USER_ID/GIT_REPO_ID": "*@dev"
28 | }
29 | }
30 | ```
31 |
32 | Then run `composer install`
33 |
34 | ### Manual Installation
35 |
36 | Download the files and include `autoload.php`:
37 |
38 | ```php
39 | require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
40 | ```
41 |
42 | ## Tests
43 |
44 | To run the unit tests:
45 |
46 | ```
47 | composer install
48 | ./vendor/bin/phpunit
49 | ```
50 |
51 | ## Getting Started
52 |
53 | Please follow the [installation procedure](#installation--usage) and then run the following:
54 |
55 | ```php
56 | ping();
67 | print_r($result);
68 | } catch (Exception $e) {
69 | echo 'Exception when calling GreetApi->ping: ', $e->getMessage(), PHP_EOL;
70 | }
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 | *GreetApi* | [**ping**](docs/Api/GreetApi.md#ping) | **GET** /user/ping |
82 | *UserApiApi* | [**getUserInfo**](docs/Api/UserApiApi.md#getuserinfo) | **GET** /api/user/{id} | 获取用户信息
83 | *UserApiApi* | [**login**](docs/Api/UserApiApi.md#login) | **POST** /api/user/login | 登录
84 | *UserApiApi* | [**register**](docs/Api/UserApiApi.md#register) | **POST** /api/user/register | 注册
85 | *UserApiApi* | [**searchUser**](docs/Api/UserApiApi.md#searchuser) | **GET** /api/user/search | 用户搜索
86 |
87 |
88 | ## Documentation For Models
89 |
90 | - [LoginReq](docs/Model/LoginReq.md)
91 | - [RegisterReq](docs/Model/RegisterReq.md)
92 | - [UserInfoReply](docs/Model/UserInfoReply.md)
93 | - [UserInfoReq](docs/Model/UserInfoReq.md)
94 | - [UserSearchReply](docs/Model/UserSearchReply.md)
95 | - [UserSearchReq](docs/Model/UserSearchReq.md)
96 |
97 |
98 | ## Documentation For Authorization
99 |
100 |
101 | ## apiKey
102 |
103 | - **Type**: API key
104 | - **API key parameter name**: Authorization
105 | - **Location**: HTTP header
106 |
107 |
108 | ## Author
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GIT_USER_ID/GIT_REPO_ID",
3 | "description": "",
4 | "keywords": [
5 | "swagger",
6 | "php",
7 | "sdk",
8 | "api"
9 | ],
10 | "homepage": "http://swagger.io",
11 | "license": "proprietary",
12 | "authors": [
13 | {
14 | "name": "Swagger and contributors",
15 | "homepage": "https://github.com/swagger-api/swagger-codegen"
16 | }
17 | ],
18 | "require": {
19 | "php": ">=5.5",
20 | "ext-curl": "*",
21 | "ext-json": "*",
22 | "ext-mbstring": "*",
23 | "guzzlehttp/guzzle": "^6.2"
24 | },
25 | "require-dev": {
26 | "phpunit/phpunit": "^4.8",
27 | "squizlabs/php_codesniffer": "~2.6",
28 | "friendsofphp/php-cs-fixer": "~2.12"
29 | },
30 | "autoload": {
31 | "psr-4": { "Swagger\\Client\\" : "lib/" }
32 | },
33 | "autoload-dev": {
34 | "psr-4": { "Swagger\\Client\\" : "test/" }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Api/GreetApi.md:
--------------------------------------------------------------------------------
1 | # Swagger\Client\GreetApi
2 |
3 | All URIs are relative to *http://localhost*
4 |
5 | Method | HTTP request | Description
6 | ------------- | ------------- | -------------
7 | [**ping**](GreetApi.md#ping) | **GET** /user/ping |
8 |
9 |
10 | # **ping**
11 | > object ping()
12 |
13 |
14 |
15 | ### Example
16 | ```php
17 | ping();
28 | print_r($result);
29 | } catch (Exception $e) {
30 | echo 'Exception when calling GreetApi->ping: ', $e->getMessage(), PHP_EOL;
31 | }
32 | ?>
33 | ```
34 |
35 | ### Parameters
36 | This endpoint does not need any parameter.
37 |
38 | ### Return type
39 |
40 | **object**
41 |
42 | ### Authorization
43 |
44 | No authorization required
45 |
46 | ### HTTP request headers
47 |
48 | - **Content-Type**: application/json
49 | - **Accept**: application/json
50 |
51 | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
52 |
53 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Api/UserApiApi.md:
--------------------------------------------------------------------------------
1 | # Swagger\Client\UserApiApi
2 |
3 | All URIs are relative to *http://localhost*
4 |
5 | Method | HTTP request | Description
6 | ------------- | ------------- | -------------
7 | [**getUserInfo**](UserApiApi.md#getUserInfo) | **GET** /api/user/{id} | 获取用户信息
8 | [**login**](UserApiApi.md#login) | **POST** /api/user/login | 登录
9 | [**register**](UserApiApi.md#register) | **POST** /api/user/register | 注册
10 | [**searchUser**](UserApiApi.md#searchUser) | **GET** /api/user/search | 用户搜索
11 |
12 |
13 | # **getUserInfo**
14 | > \Swagger\Client\Model\UserInfoReply getUserInfo($id, $body)
15 |
16 | 获取用户信息
17 |
18 | ### Example
19 | ```php
20 | getUserInfo($id, $body);
33 | print_r($result);
34 | } catch (Exception $e) {
35 | echo 'Exception when calling UserApiApi->getUserInfo: ', $e->getMessage(), PHP_EOL;
36 | }
37 | ?>
38 | ```
39 |
40 | ### Parameters
41 |
42 | Name | Type | Description | Notes
43 | ------------- | ------------- | ------------- | -------------
44 | **id** | **string**| |
45 | **body** | [**\Swagger\Client\Model\UserInfoReq**](../Model/UserInfoReq.md)| |
46 |
47 | ### Return type
48 |
49 | [**\Swagger\Client\Model\UserInfoReply**](../Model/UserInfoReply.md)
50 |
51 | ### Authorization
52 |
53 | No authorization required
54 |
55 | ### HTTP request headers
56 |
57 | - **Content-Type**: application/json
58 | - **Accept**: application/json
59 |
60 | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
61 |
62 | # **login**
63 | > object login($body)
64 |
65 | 登录
66 |
67 | ### Example
68 | ```php
69 | login($body);
81 | print_r($result);
82 | } catch (Exception $e) {
83 | echo 'Exception when calling UserApiApi->login: ', $e->getMessage(), PHP_EOL;
84 | }
85 | ?>
86 | ```
87 |
88 | ### Parameters
89 |
90 | Name | Type | Description | Notes
91 | ------------- | ------------- | ------------- | -------------
92 | **body** | [**\Swagger\Client\Model\LoginReq**](../Model/LoginReq.md)| |
93 |
94 | ### Return type
95 |
96 | **object**
97 |
98 | ### Authorization
99 |
100 | No authorization required
101 |
102 | ### HTTP request headers
103 |
104 | - **Content-Type**: application/json
105 | - **Accept**: application/json
106 |
107 | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
108 |
109 | # **register**
110 | > object register($body)
111 |
112 | 注册
113 |
114 | 注册一个用户
115 |
116 | ### Example
117 | ```php
118 | register($body);
130 | print_r($result);
131 | } catch (Exception $e) {
132 | echo 'Exception when calling UserApiApi->register: ', $e->getMessage(), PHP_EOL;
133 | }
134 | ?>
135 | ```
136 |
137 | ### Parameters
138 |
139 | Name | Type | Description | Notes
140 | ------------- | ------------- | ------------- | -------------
141 | **body** | [**\Swagger\Client\Model\RegisterReq**](../Model/RegisterReq.md)| |
142 |
143 | ### Return type
144 |
145 | **object**
146 |
147 | ### Authorization
148 |
149 | No authorization required
150 |
151 | ### HTTP request headers
152 |
153 | - **Content-Type**: application/json
154 | - **Accept**: application/json
155 |
156 | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
157 |
158 | # **searchUser**
159 | > \Swagger\Client\Model\UserSearchReply searchUser($body)
160 |
161 | 用户搜索
162 |
163 | ### Example
164 | ```php
165 | searchUser($body);
177 | print_r($result);
178 | } catch (Exception $e) {
179 | echo 'Exception when calling UserApiApi->searchUser: ', $e->getMessage(), PHP_EOL;
180 | }
181 | ?>
182 | ```
183 |
184 | ### Parameters
185 |
186 | Name | Type | Description | Notes
187 | ------------- | ------------- | ------------- | -------------
188 | **body** | [**\Swagger\Client\Model\UserSearchReq**](../Model/UserSearchReq.md)| |
189 |
190 | ### Return type
191 |
192 | [**\Swagger\Client\Model\UserSearchReply**](../Model/UserSearchReply.md)
193 |
194 | ### Authorization
195 |
196 | No authorization required
197 |
198 | ### HTTP request headers
199 |
200 | - **Content-Type**: application/json
201 | - **Accept**: application/json
202 |
203 | [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
204 |
205 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Model/LoginReq.md:
--------------------------------------------------------------------------------
1 | # LoginReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **username** | **string** | | [optional]
7 | **password** | **string** | | [optional]
8 |
9 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10 |
11 |
12 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Model/RegisterReq.md:
--------------------------------------------------------------------------------
1 | # RegisterReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **username** | **string** | | [optional]
7 | **password** | **string** | | [optional]
8 | **mobile** | **string** | | [optional]
9 |
10 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Model/UserInfoReply.md:
--------------------------------------------------------------------------------
1 | # UserInfoReply
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **name** | **string** | | [optional]
7 | **age** | **int** | | [optional]
8 | **birthday** | **string** | | [optional]
9 | **description** | **string** | | [optional]
10 | **tag** | **string[]** | | [optional]
11 |
12 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
13 |
14 |
15 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Model/UserInfoReq.md:
--------------------------------------------------------------------------------
1 | # UserInfoReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **id** | **string** | | [optional]
7 |
8 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Model/UserSearchReply.md:
--------------------------------------------------------------------------------
1 | # UserSearchReply
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **key_word** | [**\Swagger\Client\Model\UserInfoReply[]**](UserInfoReply.md) | | [optional]
7 |
8 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/docs/Model/UserSearchReq.md:
--------------------------------------------------------------------------------
1 | # UserSearchReq
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **key_word** | **string** | | [optional]
7 |
8 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/git_push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3 | #
4 | # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
5 |
6 | git_user_id=$1
7 | git_repo_id=$2
8 | release_note=$3
9 |
10 | if [ "$git_user_id" = "" ]; then
11 | git_user_id="GIT_USER_ID"
12 | echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
13 | fi
14 |
15 | if [ "$git_repo_id" = "" ]; then
16 | git_repo_id="GIT_REPO_ID"
17 | echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
18 | fi
19 |
20 | if [ "$release_note" = "" ]; then
21 | release_note="Minor update"
22 | echo "[INFO] No command line input provided. Set \$release_note to $release_note"
23 | fi
24 |
25 | # Initialize the local directory as a Git repository
26 | git init
27 |
28 | # Adds the files in the local repository and stages them for commit.
29 | git add .
30 |
31 | # Commits the tracked changes and prepares them to be pushed to a remote repository.
32 | git commit -m "$release_note"
33 |
34 | # Sets the new remote
35 | git_remote=`git remote`
36 | if [ "$git_remote" = "" ]; then # git remote not defined
37 |
38 | if [ "$GIT_TOKEN" = "" ]; then
39 | echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
40 | git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
41 | else
42 | git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
43 | fi
44 |
45 | fi
46 |
47 | git pull origin master
48 |
49 | # Pushes (Forces) the changes in the local repository up to the remote repository
50 | echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
51 | git push origin master 2>&1 | grep -v 'To https'
52 |
53 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/lib/ApiException.php:
--------------------------------------------------------------------------------
1 | responseHeaders = $responseHeaders;
77 | $this->responseBody = $responseBody;
78 | }
79 |
80 | /**
81 | * Gets the HTTP response header
82 | *
83 | * @return string[]|null HTTP response header
84 | */
85 | public function getResponseHeaders()
86 | {
87 | return $this->responseHeaders;
88 | }
89 |
90 | /**
91 | * Gets the HTTP body of the server response either as Json or string
92 | *
93 | * @return mixed HTTP body of the server response either as \stdClass or string
94 | */
95 | public function getResponseBody()
96 | {
97 | return $this->responseBody;
98 | }
99 |
100 | /**
101 | * Sets the deseralized response object (during deserialization)
102 | *
103 | * @param mixed $obj Deserialized response object
104 | *
105 | * @return void
106 | */
107 | public function setResponseObject($obj)
108 | {
109 | $this->responseObject = $obj;
110 | }
111 |
112 | /**
113 | * Gets the deseralized response object (during deserialization)
114 | *
115 | * @return mixed the deserialized response object
116 | */
117 | public function getResponseObject()
118 | {
119 | return $this->responseObject;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/lib/HeaderSelector.php:
--------------------------------------------------------------------------------
1 | selectAcceptHeader($accept);
54 | if ($accept !== null) {
55 | $headers['Accept'] = $accept;
56 | }
57 |
58 | $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes);
59 | return $headers;
60 | }
61 |
62 | /**
63 | * @param string[] $accept
64 | * @return array
65 | */
66 | public function selectHeadersForMultipart($accept)
67 | {
68 | $headers = $this->selectHeaders($accept, []);
69 |
70 | unset($headers['Content-Type']);
71 | return $headers;
72 | }
73 |
74 | /**
75 | * Return the header 'Accept' based on an array of Accept provided
76 | *
77 | * @param string[] $accept Array of header
78 | *
79 | * @return string Accept (e.g. application/json)
80 | */
81 | private function selectAcceptHeader($accept)
82 | {
83 | if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) {
84 | return null;
85 | } elseif (preg_grep("/application\/json/i", $accept)) {
86 | return 'application/json';
87 | } else {
88 | return implode(',', $accept);
89 | }
90 | }
91 |
92 | /**
93 | * Return the content type based on an array of content-type provided
94 | *
95 | * @param string[] $contentType Array fo content-type
96 | *
97 | * @return string Content-Type (e.g. application/json)
98 | */
99 | private function selectContentTypeHeader($contentType)
100 | {
101 | if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) {
102 | return 'application/json';
103 | } elseif (preg_grep("/application\/json/i", $contentType)) {
104 | return 'application/json';
105 | } else {
106 | return implode(',', $contentType);
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/lib/Model/LoginReq.php:
--------------------------------------------------------------------------------
1 | 'string',
61 | 'password' => 'string'
62 | ];
63 |
64 | /**
65 | * Array of property to format mappings. Used for (de)serialization
66 | *
67 | * @var string[]
68 | */
69 | protected static $swaggerFormats = [
70 | 'username' => null,
71 | 'password' => null
72 | ];
73 |
74 | /**
75 | * Array of property to type mappings. Used for (de)serialization
76 | *
77 | * @return array
78 | */
79 | public static function swaggerTypes()
80 | {
81 | return self::$swaggerTypes;
82 | }
83 |
84 | /**
85 | * Array of property to format mappings. Used for (de)serialization
86 | *
87 | * @return array
88 | */
89 | public static function swaggerFormats()
90 | {
91 | return self::$swaggerFormats;
92 | }
93 |
94 | /**
95 | * Array of attributes where the key is the local name,
96 | * and the value is the original name
97 | *
98 | * @var string[]
99 | */
100 | protected static $attributeMap = [
101 | 'username' => 'username',
102 | 'password' => 'password'
103 | ];
104 |
105 | /**
106 | * Array of attributes to setter functions (for deserialization of responses)
107 | *
108 | * @var string[]
109 | */
110 | protected static $setters = [
111 | 'username' => 'setUsername',
112 | 'password' => 'setPassword'
113 | ];
114 |
115 | /**
116 | * Array of attributes to getter functions (for serialization of requests)
117 | *
118 | * @var string[]
119 | */
120 | protected static $getters = [
121 | 'username' => 'getUsername',
122 | 'password' => 'getPassword'
123 | ];
124 |
125 | /**
126 | * Array of attributes where the key is the local name,
127 | * and the value is the original name
128 | *
129 | * @return array
130 | */
131 | public static function attributeMap()
132 | {
133 | return self::$attributeMap;
134 | }
135 |
136 | /**
137 | * Array of attributes to setter functions (for deserialization of responses)
138 | *
139 | * @return array
140 | */
141 | public static function setters()
142 | {
143 | return self::$setters;
144 | }
145 |
146 | /**
147 | * Array of attributes to getter functions (for serialization of requests)
148 | *
149 | * @return array
150 | */
151 | public static function getters()
152 | {
153 | return self::$getters;
154 | }
155 |
156 | /**
157 | * The original name of the model.
158 | *
159 | * @return string
160 | */
161 | public function getModelName()
162 | {
163 | return self::$swaggerModelName;
164 | }
165 |
166 |
167 |
168 |
169 |
170 | /**
171 | * Associative array for storing property values
172 | *
173 | * @var mixed[]
174 | */
175 | protected $container = [];
176 |
177 | /**
178 | * Constructor
179 | *
180 | * @param mixed[] $data Associated array of property values
181 | * initializing the model
182 | */
183 | public function __construct(array $data = null)
184 | {
185 | $this->container['username'] = isset($data['username']) ? $data['username'] : null;
186 | $this->container['password'] = isset($data['password']) ? $data['password'] : null;
187 | }
188 |
189 | /**
190 | * Show all the invalid properties with reasons.
191 | *
192 | * @return array invalid properties with reasons
193 | */
194 | public function listInvalidProperties()
195 | {
196 | $invalidProperties = [];
197 |
198 | return $invalidProperties;
199 | }
200 |
201 | /**
202 | * Validate all the properties in the model
203 | * return true if all passed
204 | *
205 | * @return bool True if all properties are valid
206 | */
207 | public function valid()
208 | {
209 | return count($this->listInvalidProperties()) === 0;
210 | }
211 |
212 |
213 | /**
214 | * Gets username
215 | *
216 | * @return string
217 | */
218 | public function getUsername()
219 | {
220 | return $this->container['username'];
221 | }
222 |
223 | /**
224 | * Sets username
225 | *
226 | * @param string $username username
227 | *
228 | * @return $this
229 | */
230 | public function setUsername($username)
231 | {
232 | $this->container['username'] = $username;
233 |
234 | return $this;
235 | }
236 |
237 | /**
238 | * Gets password
239 | *
240 | * @return string
241 | */
242 | public function getPassword()
243 | {
244 | return $this->container['password'];
245 | }
246 |
247 | /**
248 | * Sets password
249 | *
250 | * @param string $password password
251 | *
252 | * @return $this
253 | */
254 | public function setPassword($password)
255 | {
256 | $this->container['password'] = $password;
257 |
258 | return $this;
259 | }
260 | /**
261 | * Returns true if offset exists. False otherwise.
262 | *
263 | * @param integer $offset Offset
264 | *
265 | * @return boolean
266 | */
267 | public function offsetExists($offset)
268 | {
269 | return isset($this->container[$offset]);
270 | }
271 |
272 | /**
273 | * Gets offset.
274 | *
275 | * @param integer $offset Offset
276 | *
277 | * @return mixed
278 | */
279 | public function offsetGet($offset)
280 | {
281 | return isset($this->container[$offset]) ? $this->container[$offset] : null;
282 | }
283 |
284 | /**
285 | * Sets value based on offset.
286 | *
287 | * @param integer $offset Offset
288 | * @param mixed $value Value to be set
289 | *
290 | * @return void
291 | */
292 | public function offsetSet($offset, $value)
293 | {
294 | if (is_null($offset)) {
295 | $this->container[] = $value;
296 | } else {
297 | $this->container[$offset] = $value;
298 | }
299 | }
300 |
301 | /**
302 | * Unsets offset.
303 | *
304 | * @param integer $offset Offset
305 | *
306 | * @return void
307 | */
308 | public function offsetUnset($offset)
309 | {
310 | unset($this->container[$offset]);
311 | }
312 |
313 | /**
314 | * Gets the string presentation of the object
315 | *
316 | * @return string
317 | */
318 | public function __toString()
319 | {
320 | if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
321 | return json_encode(
322 | ObjectSerializer::sanitizeForSerialization($this),
323 | JSON_PRETTY_PRINT
324 | );
325 | }
326 |
327 | return json_encode(ObjectSerializer::sanitizeForSerialization($this));
328 | }
329 | }
330 |
331 |
332 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/lib/Model/ModelInterface.php:
--------------------------------------------------------------------------------
1 | 'string'
61 | ];
62 |
63 | /**
64 | * Array of property to format mappings. Used for (de)serialization
65 | *
66 | * @var string[]
67 | */
68 | protected static $swaggerFormats = [
69 | 'id' => null
70 | ];
71 |
72 | /**
73 | * Array of property to type mappings. Used for (de)serialization
74 | *
75 | * @return array
76 | */
77 | public static function swaggerTypes()
78 | {
79 | return self::$swaggerTypes;
80 | }
81 |
82 | /**
83 | * Array of property to format mappings. Used for (de)serialization
84 | *
85 | * @return array
86 | */
87 | public static function swaggerFormats()
88 | {
89 | return self::$swaggerFormats;
90 | }
91 |
92 | /**
93 | * Array of attributes where the key is the local name,
94 | * and the value is the original name
95 | *
96 | * @var string[]
97 | */
98 | protected static $attributeMap = [
99 | 'id' => 'id'
100 | ];
101 |
102 | /**
103 | * Array of attributes to setter functions (for deserialization of responses)
104 | *
105 | * @var string[]
106 | */
107 | protected static $setters = [
108 | 'id' => 'setId'
109 | ];
110 |
111 | /**
112 | * Array of attributes to getter functions (for serialization of requests)
113 | *
114 | * @var string[]
115 | */
116 | protected static $getters = [
117 | 'id' => 'getId'
118 | ];
119 |
120 | /**
121 | * Array of attributes where the key is the local name,
122 | * and the value is the original name
123 | *
124 | * @return array
125 | */
126 | public static function attributeMap()
127 | {
128 | return self::$attributeMap;
129 | }
130 |
131 | /**
132 | * Array of attributes to setter functions (for deserialization of responses)
133 | *
134 | * @return array
135 | */
136 | public static function setters()
137 | {
138 | return self::$setters;
139 | }
140 |
141 | /**
142 | * Array of attributes to getter functions (for serialization of requests)
143 | *
144 | * @return array
145 | */
146 | public static function getters()
147 | {
148 | return self::$getters;
149 | }
150 |
151 | /**
152 | * The original name of the model.
153 | *
154 | * @return string
155 | */
156 | public function getModelName()
157 | {
158 | return self::$swaggerModelName;
159 | }
160 |
161 |
162 |
163 |
164 |
165 | /**
166 | * Associative array for storing property values
167 | *
168 | * @var mixed[]
169 | */
170 | protected $container = [];
171 |
172 | /**
173 | * Constructor
174 | *
175 | * @param mixed[] $data Associated array of property values
176 | * initializing the model
177 | */
178 | public function __construct(array $data = null)
179 | {
180 | $this->container['id'] = isset($data['id']) ? $data['id'] : null;
181 | }
182 |
183 | /**
184 | * Show all the invalid properties with reasons.
185 | *
186 | * @return array invalid properties with reasons
187 | */
188 | public function listInvalidProperties()
189 | {
190 | $invalidProperties = [];
191 |
192 | return $invalidProperties;
193 | }
194 |
195 | /**
196 | * Validate all the properties in the model
197 | * return true if all passed
198 | *
199 | * @return bool True if all properties are valid
200 | */
201 | public function valid()
202 | {
203 | return count($this->listInvalidProperties()) === 0;
204 | }
205 |
206 |
207 | /**
208 | * Gets id
209 | *
210 | * @return string
211 | */
212 | public function getId()
213 | {
214 | return $this->container['id'];
215 | }
216 |
217 | /**
218 | * Sets id
219 | *
220 | * @param string $id id
221 | *
222 | * @return $this
223 | */
224 | public function setId($id)
225 | {
226 | $this->container['id'] = $id;
227 |
228 | return $this;
229 | }
230 | /**
231 | * Returns true if offset exists. False otherwise.
232 | *
233 | * @param integer $offset Offset
234 | *
235 | * @return boolean
236 | */
237 | public function offsetExists($offset)
238 | {
239 | return isset($this->container[$offset]);
240 | }
241 |
242 | /**
243 | * Gets offset.
244 | *
245 | * @param integer $offset Offset
246 | *
247 | * @return mixed
248 | */
249 | public function offsetGet($offset)
250 | {
251 | return isset($this->container[$offset]) ? $this->container[$offset] : null;
252 | }
253 |
254 | /**
255 | * Sets value based on offset.
256 | *
257 | * @param integer $offset Offset
258 | * @param mixed $value Value to be set
259 | *
260 | * @return void
261 | */
262 | public function offsetSet($offset, $value)
263 | {
264 | if (is_null($offset)) {
265 | $this->container[] = $value;
266 | } else {
267 | $this->container[$offset] = $value;
268 | }
269 | }
270 |
271 | /**
272 | * Unsets offset.
273 | *
274 | * @param integer $offset Offset
275 | *
276 | * @return void
277 | */
278 | public function offsetUnset($offset)
279 | {
280 | unset($this->container[$offset]);
281 | }
282 |
283 | /**
284 | * Gets the string presentation of the object
285 | *
286 | * @return string
287 | */
288 | public function __toString()
289 | {
290 | if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
291 | return json_encode(
292 | ObjectSerializer::sanitizeForSerialization($this),
293 | JSON_PRETTY_PRINT
294 | );
295 | }
296 |
297 | return json_encode(ObjectSerializer::sanitizeForSerialization($this));
298 | }
299 | }
300 |
301 |
302 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/lib/Model/UserSearchReply.php:
--------------------------------------------------------------------------------
1 | '\Swagger\Client\Model\UserInfoReply[]'
61 | ];
62 |
63 | /**
64 | * Array of property to format mappings. Used for (de)serialization
65 | *
66 | * @var string[]
67 | */
68 | protected static $swaggerFormats = [
69 | 'key_word' => null
70 | ];
71 |
72 | /**
73 | * Array of property to type mappings. Used for (de)serialization
74 | *
75 | * @return array
76 | */
77 | public static function swaggerTypes()
78 | {
79 | return self::$swaggerTypes;
80 | }
81 |
82 | /**
83 | * Array of property to format mappings. Used for (de)serialization
84 | *
85 | * @return array
86 | */
87 | public static function swaggerFormats()
88 | {
89 | return self::$swaggerFormats;
90 | }
91 |
92 | /**
93 | * Array of attributes where the key is the local name,
94 | * and the value is the original name
95 | *
96 | * @var string[]
97 | */
98 | protected static $attributeMap = [
99 | 'key_word' => 'KeyWord'
100 | ];
101 |
102 | /**
103 | * Array of attributes to setter functions (for deserialization of responses)
104 | *
105 | * @var string[]
106 | */
107 | protected static $setters = [
108 | 'key_word' => 'setKeyWord'
109 | ];
110 |
111 | /**
112 | * Array of attributes to getter functions (for serialization of requests)
113 | *
114 | * @var string[]
115 | */
116 | protected static $getters = [
117 | 'key_word' => 'getKeyWord'
118 | ];
119 |
120 | /**
121 | * Array of attributes where the key is the local name,
122 | * and the value is the original name
123 | *
124 | * @return array
125 | */
126 | public static function attributeMap()
127 | {
128 | return self::$attributeMap;
129 | }
130 |
131 | /**
132 | * Array of attributes to setter functions (for deserialization of responses)
133 | *
134 | * @return array
135 | */
136 | public static function setters()
137 | {
138 | return self::$setters;
139 | }
140 |
141 | /**
142 | * Array of attributes to getter functions (for serialization of requests)
143 | *
144 | * @return array
145 | */
146 | public static function getters()
147 | {
148 | return self::$getters;
149 | }
150 |
151 | /**
152 | * The original name of the model.
153 | *
154 | * @return string
155 | */
156 | public function getModelName()
157 | {
158 | return self::$swaggerModelName;
159 | }
160 |
161 |
162 |
163 |
164 |
165 | /**
166 | * Associative array for storing property values
167 | *
168 | * @var mixed[]
169 | */
170 | protected $container = [];
171 |
172 | /**
173 | * Constructor
174 | *
175 | * @param mixed[] $data Associated array of property values
176 | * initializing the model
177 | */
178 | public function __construct(array $data = null)
179 | {
180 | $this->container['key_word'] = isset($data['key_word']) ? $data['key_word'] : null;
181 | }
182 |
183 | /**
184 | * Show all the invalid properties with reasons.
185 | *
186 | * @return array invalid properties with reasons
187 | */
188 | public function listInvalidProperties()
189 | {
190 | $invalidProperties = [];
191 |
192 | return $invalidProperties;
193 | }
194 |
195 | /**
196 | * Validate all the properties in the model
197 | * return true if all passed
198 | *
199 | * @return bool True if all properties are valid
200 | */
201 | public function valid()
202 | {
203 | return count($this->listInvalidProperties()) === 0;
204 | }
205 |
206 |
207 | /**
208 | * Gets key_word
209 | *
210 | * @return \Swagger\Client\Model\UserInfoReply[]
211 | */
212 | public function getKeyWord()
213 | {
214 | return $this->container['key_word'];
215 | }
216 |
217 | /**
218 | * Sets key_word
219 | *
220 | * @param \Swagger\Client\Model\UserInfoReply[] $key_word key_word
221 | *
222 | * @return $this
223 | */
224 | public function setKeyWord($key_word)
225 | {
226 | $this->container['key_word'] = $key_word;
227 |
228 | return $this;
229 | }
230 | /**
231 | * Returns true if offset exists. False otherwise.
232 | *
233 | * @param integer $offset Offset
234 | *
235 | * @return boolean
236 | */
237 | public function offsetExists($offset)
238 | {
239 | return isset($this->container[$offset]);
240 | }
241 |
242 | /**
243 | * Gets offset.
244 | *
245 | * @param integer $offset Offset
246 | *
247 | * @return mixed
248 | */
249 | public function offsetGet($offset)
250 | {
251 | return isset($this->container[$offset]) ? $this->container[$offset] : null;
252 | }
253 |
254 | /**
255 | * Sets value based on offset.
256 | *
257 | * @param integer $offset Offset
258 | * @param mixed $value Value to be set
259 | *
260 | * @return void
261 | */
262 | public function offsetSet($offset, $value)
263 | {
264 | if (is_null($offset)) {
265 | $this->container[] = $value;
266 | } else {
267 | $this->container[$offset] = $value;
268 | }
269 | }
270 |
271 | /**
272 | * Unsets offset.
273 | *
274 | * @param integer $offset Offset
275 | *
276 | * @return void
277 | */
278 | public function offsetUnset($offset)
279 | {
280 | unset($this->container[$offset]);
281 | }
282 |
283 | /**
284 | * Gets the string presentation of the object
285 | *
286 | * @return string
287 | */
288 | public function __toString()
289 | {
290 | if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
291 | return json_encode(
292 | ObjectSerializer::sanitizeForSerialization($this),
293 | JSON_PRETTY_PRINT
294 | );
295 | }
296 |
297 | return json_encode(ObjectSerializer::sanitizeForSerialization($this));
298 | }
299 | }
300 |
301 |
302 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/lib/Model/UserSearchReq.php:
--------------------------------------------------------------------------------
1 | 'string'
61 | ];
62 |
63 | /**
64 | * Array of property to format mappings. Used for (de)serialization
65 | *
66 | * @var string[]
67 | */
68 | protected static $swaggerFormats = [
69 | 'key_word' => null
70 | ];
71 |
72 | /**
73 | * Array of property to type mappings. Used for (de)serialization
74 | *
75 | * @return array
76 | */
77 | public static function swaggerTypes()
78 | {
79 | return self::$swaggerTypes;
80 | }
81 |
82 | /**
83 | * Array of property to format mappings. Used for (de)serialization
84 | *
85 | * @return array
86 | */
87 | public static function swaggerFormats()
88 | {
89 | return self::$swaggerFormats;
90 | }
91 |
92 | /**
93 | * Array of attributes where the key is the local name,
94 | * and the value is the original name
95 | *
96 | * @var string[]
97 | */
98 | protected static $attributeMap = [
99 | 'key_word' => 'keyWord'
100 | ];
101 |
102 | /**
103 | * Array of attributes to setter functions (for deserialization of responses)
104 | *
105 | * @var string[]
106 | */
107 | protected static $setters = [
108 | 'key_word' => 'setKeyWord'
109 | ];
110 |
111 | /**
112 | * Array of attributes to getter functions (for serialization of requests)
113 | *
114 | * @var string[]
115 | */
116 | protected static $getters = [
117 | 'key_word' => 'getKeyWord'
118 | ];
119 |
120 | /**
121 | * Array of attributes where the key is the local name,
122 | * and the value is the original name
123 | *
124 | * @return array
125 | */
126 | public static function attributeMap()
127 | {
128 | return self::$attributeMap;
129 | }
130 |
131 | /**
132 | * Array of attributes to setter functions (for deserialization of responses)
133 | *
134 | * @return array
135 | */
136 | public static function setters()
137 | {
138 | return self::$setters;
139 | }
140 |
141 | /**
142 | * Array of attributes to getter functions (for serialization of requests)
143 | *
144 | * @return array
145 | */
146 | public static function getters()
147 | {
148 | return self::$getters;
149 | }
150 |
151 | /**
152 | * The original name of the model.
153 | *
154 | * @return string
155 | */
156 | public function getModelName()
157 | {
158 | return self::$swaggerModelName;
159 | }
160 |
161 |
162 |
163 |
164 |
165 | /**
166 | * Associative array for storing property values
167 | *
168 | * @var mixed[]
169 | */
170 | protected $container = [];
171 |
172 | /**
173 | * Constructor
174 | *
175 | * @param mixed[] $data Associated array of property values
176 | * initializing the model
177 | */
178 | public function __construct(array $data = null)
179 | {
180 | $this->container['key_word'] = isset($data['key_word']) ? $data['key_word'] : null;
181 | }
182 |
183 | /**
184 | * Show all the invalid properties with reasons.
185 | *
186 | * @return array invalid properties with reasons
187 | */
188 | public function listInvalidProperties()
189 | {
190 | $invalidProperties = [];
191 |
192 | return $invalidProperties;
193 | }
194 |
195 | /**
196 | * Validate all the properties in the model
197 | * return true if all passed
198 | *
199 | * @return bool True if all properties are valid
200 | */
201 | public function valid()
202 | {
203 | return count($this->listInvalidProperties()) === 0;
204 | }
205 |
206 |
207 | /**
208 | * Gets key_word
209 | *
210 | * @return string
211 | */
212 | public function getKeyWord()
213 | {
214 | return $this->container['key_word'];
215 | }
216 |
217 | /**
218 | * Sets key_word
219 | *
220 | * @param string $key_word key_word
221 | *
222 | * @return $this
223 | */
224 | public function setKeyWord($key_word)
225 | {
226 | $this->container['key_word'] = $key_word;
227 |
228 | return $this;
229 | }
230 | /**
231 | * Returns true if offset exists. False otherwise.
232 | *
233 | * @param integer $offset Offset
234 | *
235 | * @return boolean
236 | */
237 | public function offsetExists($offset)
238 | {
239 | return isset($this->container[$offset]);
240 | }
241 |
242 | /**
243 | * Gets offset.
244 | *
245 | * @param integer $offset Offset
246 | *
247 | * @return mixed
248 | */
249 | public function offsetGet($offset)
250 | {
251 | return isset($this->container[$offset]) ? $this->container[$offset] : null;
252 | }
253 |
254 | /**
255 | * Sets value based on offset.
256 | *
257 | * @param integer $offset Offset
258 | * @param mixed $value Value to be set
259 | *
260 | * @return void
261 | */
262 | public function offsetSet($offset, $value)
263 | {
264 | if (is_null($offset)) {
265 | $this->container[] = $value;
266 | } else {
267 | $this->container[$offset] = $value;
268 | }
269 | }
270 |
271 | /**
272 | * Unsets offset.
273 | *
274 | * @param integer $offset Offset
275 | *
276 | * @return void
277 | */
278 | public function offsetUnset($offset)
279 | {
280 | unset($this->container[$offset]);
281 | }
282 |
283 | /**
284 | * Gets the string presentation of the object
285 | *
286 | * @return string
287 | */
288 | public function __toString()
289 | {
290 | if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
291 | return json_encode(
292 | ObjectSerializer::sanitizeForSerialization($this),
293 | JSON_PRETTY_PRINT
294 | );
295 | }
296 |
297 | return json_encode(ObjectSerializer::sanitizeForSerialization($this));
298 | }
299 | }
300 |
301 |
302 |
--------------------------------------------------------------------------------
/example/clients/php/SwaggerClient-php/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |