Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openapi spec #82

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
605 changes: 605 additions & 0 deletions api/Controllers/Documentation.php

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions api/Controllers/partials/AsmaAlHusna.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
namespace Api\Controllers\partials;

use OpenApi\Attributes as OA;

#[OA\OpenApi(
openapi: '3.1.0',
info: new OA\Info(
version: 'v1',
description: "A RESTful API to get islamic prayer times for a given day, month or year.
The API has several endpoints to assist developers. All the endpoints return JSON and are available over `http` and `https`.
Please note that prayer timings might not always match your local mosque or government authority. Their timings are likely tuned or adjusted. Please see `https://aladhan.com/calculation-methods` for more details.",
title: 'AlAdhan - Prayer Times Asma-Al-Husna API'
),
servers: [
new OA\Server(url: 'http://api.aladhan.com'),
new OA\Server(url: 'https://api.aladhan.com')
],
tags: [
new OA\Tag(name: 'AsmaAlHusna')
]

)]
#[OA\Components(
schemas: [
new OA\Schema(
schema: 'AsmaAlHusnaResponse',
properties: [
new OA\Property(property: 'name', type: 'string', example: "الرَّحْمَنُ"),
new OA\Property(property: 'transliteration', type: 'string', example: 'Ar Rahmaan'),
new OA\Property(property: 'number', type: 'integer', example: 1),
new OA\Property(property: 'en', properties: [
new OA\Property(property: 'meaning', type: 'string', example: 'The Beneficent')
],
type: 'object'),
],
)
]
)]
class AsmaAlHusna
{

}
46 changes: 46 additions & 0 deletions api/Controllers/partials/DateTime.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace Api\Controllers\partials;
use OpenApi\Attributes as OA;

#[OA\OpenApi(
openapi: '3.1.0',
info: new OA\Info(
version: 'v1',
description: "A RESTful API to get islamic prayer times for a given day, month or year.
The API has several endpoints to assist developers. All the endpoints return JSON and are available over `http` and `https`.
Please note that prayer timings might not always match your local mosque or government authority. Their timings are likely tuned or adjusted. Please see `https://aladhan.com/calculation-methods` for more details.",
title: 'AlAdhan - Prayer Times DateTime API'
),
servers: [
new OA\Server(url: 'http://api.aladhan.com'),
new OA\Server(url: 'https://api.aladhan.com')
],
tags: [
new OA\Tag(name: 'DateAndTime')
]
)]

#[OA\Components(
responses: [
new OA\Response(response: '400DateTimeResponse', description: 'Unable to process request',
content: new OA\MediaType(mediaType: 'application/json',
schema: new OA\Schema(
properties: [
new OA\Property(property: 'code', type: 'integer', example: 400),
new OA\Property(property: 'status', type: 'string', example: 'BAD_REQUEST'),
new OA\Property(property: 'data', type: 'integer', example: 'Please specify a valid timezone. Example: Europe/London')
],
)
)
)
],
parameters: [
new OA\QueryParameter(parameter: 'TimeZoneQueryParameter', name: 'zone', description: 'TimeZone', in: 'query',
required: true, schema: new OA\Schema(type: 'string'), example: '?zone=Asia/Gaza')
]
)]
class DateTime
{

}
58 changes: 58 additions & 0 deletions api/Controllers/partials/Geo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Api\Controllers\partials;
use OpenApi\Attributes as OA;

#[OA\OpenApi(
openapi: '3.1.0',
info: new OA\Info(
version: 'v1',
description: "A RESTful API to get islamic prayer times for a given day, month or year.
The API has several endpoints to assist developers. All the endpoints return JSON and are available over `http` and `https`.
Please note that prayer timings might not always match your local mosque or government authority. Their timings are likely tuned or adjusted. Please see `https://aladhan.com/calculation-methods` for more details.",
title: 'AlAdhan - Prayer Times Geo API'
),
servers: [
new OA\Server(url: 'http://api.aladhan.com'),
new OA\Server(url: 'https://api.aladhan.com')
],
tags: [
new OA\Tag(name: 'Geo')
]
)]

#[OA\Components(
responses: [
new OA\Response(response: '200GeoResponse', description: 'Returns City information for the given city and country',
content: new OA\MediaType(mediaType: 'application/json',
schema: new OA\Schema(
properties: [
new OA\Property(property: 'code', type: 'integer', example: 200),
new OA\Property(property: 'status', type: 'string', example: 'OK'),
new OA\Property(property: 'data',
properties: [
new OA\Property(property: 'latitude', type: 'number', example: 51.509648),
new OA\Property(property: 'longitude', type: 'number', example: -0.099076),
new OA\Property(property: 'timezone', type: 'string', example: "Europe/London")
], type: 'object'
)
]
)
)
),
],
parameters: [
new OA\QueryParameter(parameter: 'TimingsAddressQueryParameter', name: 'address', description: 'Address of user location',
in: 'query', required: true, schema: new OA\Schema(type: 'string'), example: '?address=A5204, London'),
new OA\QueryParameter(parameter: 'TimingsCityQueryParameter', name: 'city', description: 'Name of the city',
in: 'query', required: true, schema: new OA\Schema(type: 'string'), example: '?city=London'),
new OA\QueryParameter(parameter: 'TimingsCountryQueryParameter',name: 'country', description: 'A country name or 2 character alpha ISO 3166 code',
in: 'query', required: true, schema: new OA\Schema(type: 'string'), example: '&country=GB'),
new OA\QueryParameter(parameter: '7xAPIKeyQueryParameter', name: 'x7xapikey', description: '7x API Key', in: 'query',
required: false, schema: new OA\Schema(type: 'string'), example: '&x7xapikey=P244d623e2fe2daf56359fxxxxx')
]
)]
class Geo
{

}
167 changes: 167 additions & 0 deletions api/Controllers/partials/Hijri.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?php
namespace Api\Controllers\partials;
use OpenApi\Attributes as OA;

#[OA\OpenApi(
openapi: '3.1.0',
info: new OA\Info(
version: 'v1',
description: "A RESTful API to get islamic prayer times for a given day, month or year.
The API has several endpoints to assist developers. All the endpoints return JSON and are available over `http` and `https`.
Please note that prayer timings might not always match your local mosque or government authority. Their timings are likely tuned or adjusted. Please see `https://aladhan.com/calculation-methods` for more details.",
title: 'AlAdhan - Prayer Times Islamic-Calendar API'
),
servers: [
new OA\Server(url: 'http://api.aladhan.com'),
new OA\Server(url: 'https://api.aladhan.com')
],
tags: [
new OA\Tag(name: 'Hijri')
]

)]
#[OA\Components(
schemas: [
new OA\Schema(
schema: 'HijriCalendarDateResponse',
properties: [
new OA\Property(property: 'hijri',
properties: [
new OA\Property(property: 'date', type: 'string', example: '01-04-1439'),
new OA\Property(property: 'format', type: 'string', example: 'DD-MM-YYYY'),
new OA\Property(property: 'day', type: 'integer', example: 1),
new OA\Property(property: 'weekday', properties: [
new OA\Property(property: 'en', type: 'string', example: 'Al Thalaata'),
new OA\Property(property: 'ar', type: 'string', example: "الثلاثاء"),
],type: 'object'),
new OA\Property(property: 'month', properties: [
new OA\Property(property: 'number', type: 'integer', example: 4),
new OA\Property(property: 'en', type: 'string', example: "Rabīʿ al-thānī"),
new OA\Property(property: 'ar', type: 'string', example: "رَبيع الثاني"),
new OA\Property(property: 'days', type: 'integer', example: 30)
], type: 'object'),
new OA\Property(property: 'year', type: 'integer', example: 1439),
new OA\Property(property: 'designation', properties: [
new OA\Property(property: 'abbreviated', type: 'string', example: 'AH'),
new OA\Property(property: 'expanded', type: 'string', example: 'Anno Hegirae'),
],type: 'object'),
new OA\Property(property: 'holidays', type: 'array', items: new OA\Items(), example: []),
new OA\Property(property: 'method', type: 'string', example: 'HJCoSA')
], type: 'object'),

new OA\Property(property: 'gregorian',
properties: [
new OA\Property(property: 'date', type: 'string', example: '19-12-2017'),
new OA\Property(property: 'format', type: 'string', example: 'DD-MM-YYYY'),
new OA\Property(property: 'day', type: 'string', example: '19'),
new OA\Property(property: 'weekday', properties: [
new OA\Property(property: 'en', type: 'string', example: 'Tuesday')
],type: 'object'),
new OA\Property(property: 'month', properties: [
new OA\Property(property: 'number', type: 'integer', example: 12),
new OA\Property(property: 'en', type: 'string', example: "December"),
], type: 'object'),
new OA\Property(property: 'year', type: 'string', example: '2017'),
new OA\Property(property: 'designation', properties: [
new OA\Property(property: 'abbreviated', type: 'string', example: 'AD'),
new OA\Property(property: 'expanded', type: 'string', example: 'Anno Domini'),
],type: 'object'),
], type: 'object'),
]
),
new OA\Schema(
schema: 'HijriHolidayResponse',
properties: [
new OA\Property(property: 'hijri',
properties: [
new OA\Property(property: 'date', type: 'string', example: '10-01-1443'),
new OA\Property(property: 'format', type: 'string', example: 'DD-MM-YYYY'),
new OA\Property(property: 'day', type: 'integer', example: 10),
new OA\Property(property: 'weekday', properties: [
new OA\Property(property: 'en', type: 'string', example: "Al Arba'a"),
new OA\Property(property: 'ar', type: 'string', example: "الاربعاء"),
],type: 'object'),
new OA\Property(property: 'month', properties: [
new OA\Property(property: 'number', type: 'integer', example: 1),
new OA\Property(property: 'en', type: 'string', example: "Muḥarram"),
new OA\Property(property: 'ar', type: 'string', example: "مُحَرَّم"),
new OA\Property(property: 'days', type: 'integer', example: 30)
], type: 'object'),
new OA\Property(property: 'year', type: 'integer', example: 1443),
new OA\Property(property: 'designation', properties: [
new OA\Property(property: 'abbreviated', type: 'string', example: 'AH'),
new OA\Property(property: 'expanded', type: 'string', example: 'Anno Hegirae'),
],type: 'object'),
new OA\Property(property: 'holidays', type: 'array', items: new OA\Items(), example: ["Ashura"]),
new OA\Property(property: 'method', type: 'string', example: 'HJCoSA')
], type: 'object'),

new OA\Property(property: 'gregorian',
properties: [
new OA\Property(property: 'date', type: 'string', example: '18-08-2021'),
new OA\Property(property: 'format', type: 'string', example: 'DD-MM-YYYY'),
new OA\Property(property: 'day', type: 'string', example: '18'),
new OA\Property(property: 'weekday', properties: [
new OA\Property(property: 'en', type: 'string', example: 'Wednesday')
],type: 'object'),
new OA\Property(property: 'month', properties: [
new OA\Property(property: 'number', type: 'integer', example: 8),
new OA\Property(property: 'en', type: 'string', example: "August"),
], type: 'object'),
new OA\Property(property: 'year', type: 'string', example: '2021'),
new OA\Property(property: 'designation', properties: [
new OA\Property(property: 'abbreviated', type: 'string', example: 'AD'),
new OA\Property(property: 'expanded', type: 'string', example: 'Anno Domini'),
],type: 'object'),
], type: 'object'),
]
)
],
responses: [
new OA\Response(response: '404HijriResponse', description: 'NOT FOUND - Unable to process request',
content: new OA\MediaType(mediaType: 'application/json',
schema: new OA\Schema(
properties: [
new OA\Property(property: 'code', type: 'integer', example: 404),
new OA\Property(property: 'status', type: 'string', example: 'NOT FOUND'),
new OA\Property(property: 'data', type: 'string', example: 'Invalid date or unable to convert it.')
]
)
)
),
new OA\Response(response: '200HijriCurrentYearResponse', description: 'Returns current Islamic year',
content: new OA\MediaType(mediaType: 'application/json',
schema: new OA\Schema(
properties: [
new OA\Property(property: 'code', type: 'integer', example: 200),
new OA\Property(property: 'status', type: 'string', example: 'OK'),
new OA\Property(property: 'data', type: 'integer', example: 1446)
],
)
)
),
new OA\Response(response: '404HijriHolidaysResponse', description: 'NOT FOUND - Unable to process request',
content: new OA\MediaType(mediaType: 'application/json',
schema: new OA\Schema(
properties: [
new OA\Property(property: 'code', type: 'integer', example: 404),
new OA\Property(property: 'status', type: 'string', example: 'NOT FOUND'),
new OA\Property(property: 'data', type: 'string', example: 'No holidays found.')
]
)
)
)
],
parameters: [
new OA\PathParameter(parameter: 'HijriMonth', name: 'month', description: 'Month number as per the Hijri calendar', in: 'path',
required: true, schema: new OA\Schema(type: 'integer'), example: 4),
new OA\PathParameter(parameter: 'HijriYear', name: 'year', description: 'Year as per the Hijri calendar', in: 'path',
required: true, schema: new OA\Schema(type: 'integer'), example: 1439),
new OA\PathParameter(parameter: 'GregorianYear', name: 'year', description: 'Year as per the Gregorian calendar', in: 'path',
required: true, schema: new OA\Schema(type: 'integer'), example: 2018)
]
)]
class Hijri
{

}
28 changes: 28 additions & 0 deletions api/Controllers/partials/Qibla.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace Api\Controllers\partials;

use OpenApi\Attributes as OA;

#[OA\OpenApi(
openapi: '3.1.0',
info: new OA\Info(
version: 'v1',
description: "A RESTful API to get islamic prayer times for a given day, month or year.
The API has several endpoints to assist developers. All the endpoints return JSON and are available over `http` and `https`.
Please note that prayer timings might not always match your local mosque or government authority. Their timings are likely tuned or adjusted. Please see `https://aladhan.com/calculation-methods` for more details.",
title: 'AlAdhan - Prayer Times Qibla API'
),
servers: [
new OA\Server(url: 'http://api.aladhan.com'),
new OA\Server(url: 'https://api.aladhan.com')
],
tags: [
new OA\Tag(name: 'Qibla')
]

)]

class Qibla
{

}
Loading