@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Treaties API
@version v1
@endpoints 6
@toc api(6)

@endpoint GET /api/BusinessItem/{id}
@desc Returns business item by ID.
@required {id: str # Business item with the ID specified}
@returns(200) {value: map{id: str?, treatyId: str?, stepName: str?, steps: [str]?, itemDate: str(date-time), houses: [map]?, link: str?, sequence: int(int32), treatyUri: str(uri)?, businessItemUri: str(uri)?, houseUri: str(uri)?, houseName: str?, procedureStepUri: str(uri)?, houseId: str?, procedureStepId: str?, workpackageProcedureUri: str(uri)?}, links: [map]?} # The requested business item
@errors {400: Bad Request, 404: If the item doesn't exist}

@endpoint GET /api/GovernmentOrganisation
@desc Returns all government organisations.
@returns(200) {items: [map]?, totalResults: int(int32), itemsPerPage: int(int32), links: [map]?} # OK

@endpoint GET /api/SeriesMembership
@desc Returns all series memberships.
@returns(200) {items: [map]?, totalResults: int(int32), itemsPerPage: int(int32), links: [map]?} # OK

@endpoint GET /api/Treaty
@desc Returns a list of treaties.
@optional {SearchText: str, GovernmentOrganisationId: int(int32), Series: str, ParliamentaryProcess: str, DebateScheduled: bool, MotionsTabledAboutATreaty: bool, CommitteeRaisedConcerns: bool, House: str, Skip: int(int32), Take: int(int32)}
@returns(200) {items: [map]?, totalResults: int(int32), itemsPerPage: int(int32), links: [map]?} # A list of treaties
@errors {400: Bad Request}

@endpoint GET /api/Treaty/{id}
@desc Returns a treaty by ID.
@required {id: str # Treaty with ID specified}
@returns(200) {value: map{id: str?, name: str?, uri: str(uri)?, commandPaperPrefix: str?, commandPaperNumber: int(int32)?, commonsLayingDate: str(date-time)?, lordsLayingDate: str(date-time)?, webLink: str(uri)?, treatySeriesMembership: map{seriesMembershipType: str, uri: str(uri)?, citation: str?}, leadDepartment: map{id: int(int32), name: str?}, layingBodyDepartment: map{id: int(int32), name: str?}, parliamentaryConclusion: str, debateScheduled: str?, broughtToAttentionDate: str(date-time)?, signedDate: str(date-time)?, laidDate: str(date-time)?, pertinentDate: str(date-time)?, workpackageId: str?}, links: [map]?} # Details of the requested treaty
@errors {400: Bad Request, 404: If the treaty can't be found}

@endpoint GET /api/Treaty/{id}/BusinessItems
@desc Returns business items belonging to the treaty with ID.
@required {id: str # Business items belonging to treaty with the ID specified}
@returns(200) {items: [map]?, totalResults: int(int32), itemsPerPage: int(int32), links: [map]?} # The business items for the requested treaty
@errors {400: Bad Request, 404: If the treaty cannot be found}

@end
