1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-11 22:24:21 +01:00
fab-manager/app/doc/open_api/v1/users_doc.rb

138 lines
4.3 KiB
Ruby
Raw Normal View History

2019-03-26 14:27:39 +01:00
# frozen_string_literal: true
# openAPI documentation for user endpoint
2016-05-05 15:02:02 +02:00
class OpenAPI::V1::UsersDoc < OpenAPI::V1::BaseDoc
resource_description do
short 'Users'
desc 'Users of Fab-manager'
formats FORMATS
api_version API_VERSION
end
include OpenAPI::V1::Concerns::ParamGroups
doc_for :index do
2019-03-26 14:27:39 +01:00
api :GET, "/#{API_VERSION}/users", 'Users index'
description 'Users index, with optional pagination. Order by *created_at* descendant.'
2016-05-05 15:02:02 +02:00
param_group :pagination
2019-03-26 14:27:39 +01:00
param :email, [String, Array], optional: true, desc: 'Filter users by *email* using strict matching.'
param :user_id, [Integer, Array], optional: true, desc: 'Filter users by *id* using strict matching.'
param :created_after, DateTime, optional: true, desc: 'Filter users to accounts created after the given date.'
2019-03-26 14:27:39 +01:00
example <<-USERS
2016-05-05 15:02:02 +02:00
# /open_api/v1/users?page=1&per_page=4
{
"users": [
{
"id": 1746,
"email": "xxxxxxx@xxxx.com",
"created_at": "2016-05-04T17:21:48.403+02:00",
2022-12-06 16:08:38 +01:00
"external_id": "J5821-4"
2016-05-05 15:02:02 +02:00
"full_name": "xxxx xxxx",
2022-12-07 13:31:32 +01:00
"first_name": "xxxx",
"last_name": "xxxx",
"gender": "man",
"organization": true,
"address": "2 impasse xxxxxx, BRUXELLES",
2016-05-05 15:02:02 +02:00
"group": {
"id": 1,
"name": "standard, association",
"slug": "standard"
}
},
{
"id": 1745,
"email": "xxxxxxx@gmail.com",
"created_at": "2016-05-03T15:21:13.125+02:00",
2022-12-06 16:08:38 +01:00
"external_id": "J5846-4"
2016-05-05 15:02:02 +02:00
"full_name": "xxxxx xxxxx",
2022-12-07 13:31:32 +01:00
"first_name": "xxxxx",
"last_name": "xxxxx",
"gender": "woman",
"organization": true,
"address": "Grenoble",
2016-05-05 15:02:02 +02:00
"group": {
"id": 2,
"name": "étudiant, - de 25 ans, enseignant, demandeur d'emploi",
"slug": "student"
}
},
{
"id": 1744,
"email": "xxxxxxx@gmail.com",
"created_at": "2016-05-03T13:51:03.223+02:00",
2022-12-06 16:08:38 +01:00
"external_id": "J5900-1"
2016-05-05 15:02:02 +02:00
"full_name": "xxxxxxx xxxx",
2022-12-07 13:31:32 +01:00
"first_name": "xxxxxxx",
"last_name": "xxxx",
"gender": "man",
"organization": false,
"address": "21 rue des xxxxxx",
2016-05-05 15:02:02 +02:00
"group": {
"id": 1,
"name": "standard, association",
"slug": "standard"
}
},
{
"id": 1743,
"email": "xxxxxxxx@setecastronomy.eu",
"created_at": "2016-05-03T12:24:38.724+02:00",
2022-12-06 16:08:38 +01:00
"external_id": "P4172-4"
2016-05-05 15:02:02 +02:00
"full_name": "xxx xxxxxxx",
2022-12-07 13:31:32 +01:00
"first_name": "xxx",
"last_name": "xxxxxxx",
"gender": "woman",
"organization": false,
"address": "147 rue xxxxxx, 75000 PARIS, France",
2016-05-05 15:02:02 +02:00
"group": {
"id": 1,
"name": "standard, association",
"slug": "standard"
}
}
]
}
# /open_api/v1/users?user_id[]=1746&user_id[]=1745
{
"users": [
{
"id": 1746,
"email": "xxxxxxxxxxxx",
"created_at": "2016-05-04T17:21:48.403+02:00",
2022-12-06 16:08:38 +01:00
"external_id": "J5500-4"
2016-05-05 15:02:02 +02:00
"full_name": "xxxx xxxxxx",
2022-12-07 13:31:32 +01:00
"first_name": "xxxx",
"last_name": "xxxxxx",
"gender": "man",
"organization": true,
"address": "38100",
2016-05-05 15:02:02 +02:00
"group": {
"id": 1,
"name": "standard, association",
"slug": "standard"
}
},
{
"id": 1745,
"email": "xxxxxxxxx@gmail.com",
"created_at": "2016-05-03T15:21:13.125+02:00",
2022-12-06 16:08:38 +01:00
"external_id": null,
2016-05-05 15:02:02 +02:00
"full_name": "xxxxx xxxxxx",
2022-12-07 13:31:32 +01:00
"first_name": "xxxx",
"last_name": "xxxxxx",
"gender": "woman",
"organization": true,
"address": "",
2016-05-05 15:02:02 +02:00
"group": {
"id": 2,
"name": "étudiant, - de 25 ans, enseignant, demandeur d'emploi",
"slug": "student"
}
}
]
}
2019-03-26 14:27:39 +01:00
USERS
2016-05-05 15:02:02 +02:00
end
end