Skip to content

Commit

Permalink
chore: OPENAPI_DOC generation + linting
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis committed Sep 5, 2024
1 parent aa5c89f commit 5882e05
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 6 deletions.
226 changes: 226 additions & 0 deletions OPENAPI_DOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6691,6 +6691,130 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HealthCheck__BuildInfo'
/api/staff/v1/place:
get:
summary: Retrieves a list of rooms from the tenant place object
description: 'Retrieves a list of rooms from the tenant place object
This function supports advanced filtering using Azure AD filter syntax.
For more information on Azure AD filter syntax, visit:
https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http'
tags:
- Place
operationId: Place_index
parameters:
- name: match
in: query
description: An optional query parameter to return a subset of properties
for a resource. With match, you can specify a subset or a superset of the
default properties.
example: id,displayName
required: false
schema:
type: string
nullable: true
- name: filter
in: query
description: An optional advanced search filter using Azure AD filter syntax
to query parameter to retrieve a subset of a collection..
example: startsWith(givenName,'ben') or startsWith(surname,'ben')
required: false
schema:
type: string
nullable: true
- name: top
in: query
description: 'Optional: Use the top query parameter to specify the number
of items to be included in the result. Default value is 100'
example: "100"
required: false
schema:
type: integer
format: Int32
nullable: true
- name: skip
in: query
description: 'Optional: Use skip query parameter to set the number of items
to skip at the start of a collection.'
example: 21 to retrieve search results from 21st record
required: false
schema:
type: integer
format: Int32
nullable: true
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Office365__Room'
429:
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
400:
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
401:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
403:
description: Forbidden
404:
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
511:
description: Network Authentication Required
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
406:
description: Not Acceptable
content:
application/json:
schema:
$ref: '#/components/schemas/Application__ContentError'
415:
description: Unsupported Media Type
content:
application/json:
schema:
$ref: '#/components/schemas/Application__ContentError'
422:
description: Unprocessable Entity
content:
application/json:
schema:
$ref: '#/components/schemas/Application__ValidationError'
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
405:
description: Method Not Allowed
content:
application/json:
schema:
$ref: '#/components/schemas/Application__CommonError'
/api/staff/v1/people:
get:
summary: Retrieves a list of users from the organization directory
Expand Down Expand Up @@ -11824,6 +11948,108 @@ components:
required:
- commit
- build_time
Office365__Room:
type: object
properties:
address:
type: object
properties:
city:
type: string
nullable: true
state:
type: string
nullable: true
street:
type: string
nullable: true
countryOrRegion:
type: string
nullable: true
postalCode:
type: string
nullable: true
nullable: true
displayName:
type: string
geoCoordinates:
type: object
properties:
altitudeAccuracy:
type: number
format: Float64
nullable: true
accuracy:
type: number
format: Float64
nullable: true
altitude:
type: number
format: Float64
nullable: true
latitude:
type: number
format: Float64
nullable: true
longitude:
type: number
format: Float64
nullable: true
nullable: true
id:
type: string
phone:
type: string
nullable: true
audioDeviceName:
type: string
nullable: true
bookingType:
type: string
enum:
- reserved
- standard
nullable: true
building:
type: string
nullable: true
capacity:
type: integer
format: Int32
nullable: true
displayDeviceName:
type: string
nullable: true
emailAddress:
type: string
nullable: true
floorLabel:
type: string
nullable: true
floorNumber:
type: integer
format: Int32
nullable: true
isWheelChairAccessible:
type: boolean
nullable: true
label:
type: string
nullable: true
nickname:
type: string
nullable: true
tags:
type: array
items:
type: string
nullable: true
videoDeviceName:
type: string
nullable: true
required:
- displayName
- id
PlaceCalendar__User:
type: object
properties:
Expand Down
5 changes: 2 additions & 3 deletions spec/controllers/place_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ describe Place do
WebMock.stub(:get, "https://graph.microsoft.com/v1.0/places/microsoft.graph.room")
.to_return(body: File.read("./spec/fixtures/place/index.json"))

rooms = Office365::PlaceList.from_json(client.get(PLACE_BASE, headers: headers).body)
rooms.value.size.should eq(2)
rooms.value.first.is_a?(Office365::Room).should be_true
rooms = Array(Office365::Room).from_json(client.get(PLACE_BASE, headers: headers).body)
rooms.size.should eq(2)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/events.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Events < Application
private def confirm_access_for_add_attendee(
event : PlaceCalendar::Event,
metadata : EventMetadata,
system : PlaceOS::Client::API::Models::System? = nil,
system : PlaceOS::Client::API::Models::System? = nil
)
return if metadata.permission.public?
return if is_support?
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/place.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class Place < Application
top : Int32? = nil,
@[AC::Param::Info(description: "Optional: Use skip query parameter to set the number of items to skip at the start of a collection.", example: "21 to retrieve search results from 21st record")]
skip : Int32? = nil
) : Office365::PlaceList
) : Array(Office365::Room)
case client.client_id
when :office365
client.calendar.as(PlaceCalendar::Office365).client.list_rooms(match: match, filter: filter, top: top, skip: skip)
client.calendar.as(PlaceCalendar::Office365).client.list_rooms(match: match, filter: filter, top: top, skip: skip).as(Office365::Rooms).value
else
raise Error::NotImplemented.new("place query is not available for #{client.client_id}")
end
Expand Down

0 comments on commit 5882e05

Please sign in to comment.