This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
API.swift
364 lines (344 loc) · 10.5 KB
/
API.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
/// API.swift
/// generated by jsonschema2swift
import Foundation
import UIKit
import RxMoya
import RxSwift
struct API {
/// get_users
///
/// 社員一覧を取得する
///
/// - href: /api/users
/// - method: GET
struct GetUsers: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter after: 次のページのキー
/// - parameter before: 前のページのキー
/// - parameter companyId: 会社ID
init(after: String?, before: String?, companyId: Int) {
var params: [String: Any] = [:]
params["after"] = after?.serialized
params["before"] = before?.serialized
params["company_id"] = companyId.serialized
configuration = Configuration.init(
path: "/api/users",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// create_user
///
/// 社員情報を登録する
///
/// - href: /api/users
/// - method: POST
struct CreateUser: APITarget {
typealias Response = DataResponse<UserEntity>
var configuration: Configuration
/// - parameter name: 社員名
/// - parameter companyId: 会社ID
/// - parameter email: メールアドレス
/// - parameter departments: 所属部署
init(name: String, companyId: Int, email: String, departments: [UserDepartmentParams], profile: UserProfileParams?) {
var params: [String: Any] = [:]
params["name"] = name.serialized
params["company_id"] = companyId.serialized
params["email"] = email.serialized
params["departments"] = departments.serialized
params["profile"] = profile?.serialized
configuration = Configuration.init(
path: "/api/users",
method: .post,
parameters: params,
sampleDataString: ""
)
}
}
/// get_user
///
/// 社員情報を取得する
///
/// - href: /api/users/:userId
/// - method: GET
struct GetUser: APITarget {
typealias Response = DataResponse<UserEntity>
var configuration: Configuration
/// - parameter userid: 社員ID
init(userId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/users/\(userId)",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// update_user
///
/// 社員情報を更新する
///
/// - href: /api/users/:userId
/// - method: PATCH
struct UpdateUser: APITarget {
typealias Response = DataResponse<UserEntity>
var configuration: Configuration
/// - parameter userid: 社員ID
/// - parameter name: 社員名
/// - parameter email: メールアドレス
/// - parameter departments: 所属部署
init(userId: Int, name: String?, email: String?, departments: [UserDepartmentParams]?, profile: UserProfileParams?) {
var params: [String: Any] = [:]
params["name"] = name?.serialized
params["email"] = email?.serialized
params["departments"] = departments?.serialized
params["profile"] = profile?.serialized
configuration = Configuration.init(
path: "/api/users/\(userId)",
method: .patch,
parameters: params,
sampleDataString: ""
)
}
}
/// delete_user
///
/// 社員情報を削除する
///
/// - href: /api/users/:userId
/// - method: DELETE
struct DeleteUser: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter userid: 社員ID
init(userId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/users/\(userId)",
method: .delete,
parameters: params,
sampleDataString: ""
)
}
}
/// search_users
///
/// 社員を検索する
///
/// - href: /api/users/search
/// - method: GET
struct SearchUsers: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter departmentId: 部署ID
/// - parameter companyId: 会社ID
/// - parameter keyword: 検索キーワード
/// - parameter after: 次のページのキー
/// - parameter role: 役職名
/// - parameter before: 前のページのキー
init(departmentId: Int?, companyId: Int, keyword: String?, after: String?, role: RoleEntity.Role?, before: String?) {
var params: [String: Any] = [:]
params["department_id"] = departmentId?.serialized
params["company_id"] = companyId.serialized
params["keyword"] = keyword?.serialized
params["after"] = after?.serialized
params["role"] = role?.serialized
params["before"] = before?.serialized
configuration = Configuration.init(
path: "/api/users/search",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// get_companies
///
/// 会社一覧を取得する
///
/// - href: /api/companies
/// - method: GET
struct GetCompanies: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
init() {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/companies",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// create_company
///
/// 会社情報を登録する
///
/// - href: /api/companies
/// - method: POST
struct CreateCompany: APITarget {
typealias Response = DataResponse<CompanyEntity>
var configuration: Configuration
/// - parameter tel: 電話番号
/// ( pattern: ^[0-9]{2,5}-?[0-9]{1,4}-?[0-9]{4}$ )
/// - parameter name: 会社名
/// - parameter companyType: 会社の種類
/// - parameter listedFlag: 上場企業かどうか
/// - parameter url: 会社URL
/// - parameter address: 住所
init(tel: String?, name: String, companyType: CompanyEntity.CompanyType, listedFlag: Bool?, url: String?, address: String) {
var params: [String: Any] = [:]
params["tel"] = tel?.serialized
params["name"] = name.serialized
params["company_type"] = companyType.serialized
params["listed_flag"] = listedFlag?.serialized
params["url"] = url?.serialized
params["address"] = address.serialized
configuration = Configuration.init(
path: "/api/companies",
method: .post,
parameters: params,
sampleDataString: ""
)
}
}
/// get_company
///
/// 会社情報を取得する
///
/// - href: /api/companies/:companyId
/// - method: GET
struct GetCompany: APITarget {
typealias Response = DataResponse<CompanyEntity>
var configuration: Configuration
/// - parameter companyid: 会社ID
init(companyId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/companies/\(companyId)",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// update_company
///
/// 会社情報を更新する
///
/// - href: /api/companies/:companyId
/// - method: PATCH
struct UpdateCompany: APITarget {
typealias Response = DataResponse<CompanyEntity>
var configuration: Configuration
/// - parameter companyid: 会社ID
/// - parameter tel: 電話番号
/// ( pattern: ^[0-9]{2,5}-?[0-9]{1,4}-?[0-9]{4}$ )
/// - parameter name: 会社名
/// - parameter companyType: 会社の種類
/// - parameter listedFlag: 上場企業かどうか
/// - parameter url: 会社URL
/// - parameter address: 住所
init(companyId: Int, tel: String?, name: String?, companyType: CompanyEntity.CompanyType?, listedFlag: Bool?, url: String?, address: String?) {
var params: [String: Any] = [:]
params["tel"] = tel?.serialized
params["name"] = name?.serialized
params["company_type"] = companyType?.serialized
params["listed_flag"] = listedFlag?.serialized
params["url"] = url?.serialized
params["address"] = address?.serialized
configuration = Configuration.init(
path: "/api/companies/\(companyId)",
method: .patch,
parameters: params,
sampleDataString: ""
)
}
}
/// delete_company
///
/// 会社情報を削除する
///
/// - href: /api/companies/:companyId
/// - method: DELETE
struct DeleteCompany: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter companyid: 会社ID
init(companyId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/companies/\(companyId)",
method: .delete,
parameters: params,
sampleDataString: ""
)
}
}
/// search_company_departments
///
/// 会社の部署一覧を取得する
///
/// - href: /api/companies/:companyId/departments
/// - method: GET
struct SearchCompanyDepartments: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter companyid: 会社ID
init(companyId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/companies/\(companyId)/departments",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// search_company_department_users
///
/// 会社の部署に所属する社員一覧を取得する
///
/// - href: /api/companies/:companyId/departments/:departmentId/users
/// - method: GET
struct SearchCompanyDepartmentUsers: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter companyid: 会社ID
/// - parameter departmentid: 部署ID
init(companyId: Int, departmentId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/companies/\(companyId)/departments/\(departmentId)/users",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
/// search_company_clubs
///
/// 会社の部署に所属する社員一覧を取得する
///
/// - href: /api/companies/:companyId/clubs
/// - method: GET
struct SearchCompanyClubs: APITarget {
typealias Response = NoContentResponse
var configuration: Configuration
/// - parameter companyid: 会社ID
init(companyId: Int) {
let params: [String: Any] = [:]
configuration = Configuration.init(
path: "/api/companies/\(companyId)/clubs",
method: .get,
parameters: params,
sampleDataString: ""
)
}
}
}