Browse Source

asciidoc documentation v0.1

master
art.dambrine 3 years ago
parent
commit
2414f7c271
  1. 1
      docs/.gitignore
  2. 11
      docs/createPartner/curl-request.adoc
  3. 14
      docs/createPartner/http-request.adoc
  4. 14
      docs/createPartner/http-response.adoc
  5. 10
      docs/createPartner/httpie-request.adoc
  6. 9
      docs/createPartner/request-body.adoc
  7. 20
      docs/createPartner/request-fields.adoc
  8. 10
      docs/createPartner/response-body.adoc
  9. 4
      docs/getAPartner/curl-request.adoc
  10. 6
      docs/getAPartner/http-request.adoc
  11. 14
      docs/getAPartner/http-response.adoc
  12. 4
      docs/getAPartner/httpie-request.adoc
  13. 8
      docs/getAPartner/path-parameters.adoc
  14. 4
      docs/getAPartner/request-body.adoc
  15. 10
      docs/getAPartner/response-body.adoc
  16. 24
      docs/getAPartner/response-fields.adoc
  17. 4
      docs/getAllPartners/curl-request.adoc
  18. 6
      docs/getAllPartners/http-request.adoc
  19. 8
      docs/getAllPartners/http-response.adoc
  20. 4
      docs/getAllPartners/httpie-request.adoc
  21. 4
      docs/getAllPartners/request-body.adoc
  22. 4
      docs/getAllPartners/response-body.adoc
  23. 73
      docs/partnerapi.adoc

1
docs/.gitignore

@ -0,0 +1 @@
partnerapi.html

11
docs/createPartner/curl-request.adoc

@ -0,0 +1,11 @@
[source,bash]
----
$ curl 'http://localhost:8080/partner' -i -X POST \
-H 'Content-Type: application/json' \
-d '{
"reference" : "FYI25",
"expirationTime" : "2013-10-03T12:18:46+01:00",
"name" : "UPS",
"locale" : "en_BE"
}'
----

14
docs/createPartner/http-request.adoc

@ -0,0 +1,14 @@
[source,http,options="nowrap"]
----
POST /partner HTTP/1.1
Content-Type: application/json
Content-Length: 117
Host: localhost:8080
{
"reference" : "FYI25",
"expirationTime" : "2013-10-03T12:18:46+01:00",
"name" : "UPS",
"locale" : "en_BE"
}
----

14
docs/createPartner/http-response.adoc

@ -0,0 +1,14 @@
[source,http,options="nowrap"]
----
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 130
{
"id" : 13,
"name" : "UPS",
"reference" : "FYI25",
"locale" : "en_BE",
"expirationTime" : "2013-10-03T12:18:46+01:00"
}
----

10
docs/createPartner/httpie-request.adoc

@ -0,0 +1,10 @@
[source,bash]
----
$ echo '{
"reference" : "FYI25",
"expirationTime" : "2013-10-03T12:18:46+01:00",
"name" : "UPS",
"locale" : "en_BE"
}' | http POST 'http://localhost:8080/partner' \
'Content-Type:application/json'
----

9
docs/createPartner/request-body.adoc

@ -0,0 +1,9 @@
[source,options="nowrap"]
----
{
"reference" : "FYI25",
"expirationTime" : "2013-10-03T12:18:46+01:00",
"name" : "UPS",
"locale" : "en_BE"
}
----

20
docs/createPartner/request-fields.adoc

@ -0,0 +1,20 @@
|===
|Path|Type|Description
|`+name+`
|`+String+`
|The name of the partner
|`+reference+`
|`+String+`
|The unique reference of the partner
|`+locale+`
|`+String+`
|A valid Locale of the partner
|`+expirationTime+`
|`+String+`
|The ISO-8601 UTC date time when the partner is going to expire
|===

10
docs/createPartner/response-body.adoc

@ -0,0 +1,10 @@
[source,options="nowrap"]
----
{
"id" : 13,
"name" : "UPS",
"reference" : "FYI25",
"locale" : "en_BE",
"expirationTime" : "2013-10-03T12:18:46+01:00"
}
----

4
docs/getAPartner/curl-request.adoc

@ -0,0 +1,4 @@
[source,bash]
----
$ curl 'http://localhost:8080/partner/1' -i -X GET
----

6
docs/getAPartner/http-request.adoc

@ -0,0 +1,6 @@
[source,http,options="nowrap"]
----
GET /partner/1 HTTP/1.1
Host: localhost:8080
----

14
docs/getAPartner/http-response.adoc

@ -0,0 +1,14 @@
[source,http,options="nowrap"]
----
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 129
{
"id" : 1,
"name" : "B2boost",
"reference" : "FYI1",
"locale" : "en_BE",
"expirationTime" : "2022-11-24 17:46:00+01"
}
----

4
docs/getAPartner/httpie-request.adoc

@ -0,0 +1,4 @@
[source,bash]
----
$ http GET 'http://localhost:8080/partner/1'
----

8
docs/getAPartner/path-parameters.adoc

@ -0,0 +1,8 @@
.+/partner/{id}+
|===
|Parameter|Description
|`+id+`
|id of partner to be searched
|===

4
docs/getAPartner/request-body.adoc

@ -0,0 +1,4 @@
[source,options="nowrap"]
----
----

10
docs/getAPartner/response-body.adoc

@ -0,0 +1,10 @@
[source,options="nowrap"]
----
{
"id" : 1,
"name" : "B2boost",
"reference" : "FYI1",
"locale" : "en_BE",
"expirationTime" : "2022-11-24 17:46:00+01"
}
----

24
docs/getAPartner/response-fields.adoc

@ -0,0 +1,24 @@
|===
|Path|Type|Description
|`+id+`
|`+Number+`
|The id of the partner
|`+name+`
|`+String+`
|The name of the partner
|`+reference+`
|`+String+`
|The unique reference of the partner
|`+locale+`
|`+String+`
|A valid Locale of the partner
|`+expirationTime+`
|`+String+`
|The ISO-8601 UTC date time when the partner is going to expire
|===

4
docs/getAllPartners/curl-request.adoc

@ -0,0 +1,4 @@
[source,bash]
----
$ curl 'http://localhost:8080/partners' -i -X GET
----

6
docs/getAllPartners/http-request.adoc

@ -0,0 +1,6 @@
[source,http,options="nowrap"]
----
GET /partners HTTP/1.1
Host: localhost:8080
----

8
docs/getAllPartners/http-response.adoc

@ -0,0 +1,8 @@
[source,http,options="nowrap"]
----
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1360
[{"id":1,"name":"B2boost","reference":"FYI1","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":2,"name":"Proximus","reference":"FYI2","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":3,"name":"KBC Bank","reference":"FYI3","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":4,"name":"AB InBev","reference":"FYI4","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":5,"name":"Spotify","reference":"FYI5","locale":"sv_SE","expirationTime":"2022-11-24 17:46:00+01"},{"id":6,"name":"AMSOM-Habitat","reference":"FYI6","locale":"fr_FR","expirationTime":"2022-11-24 17:46:00+01"},{"id":7,"name":"Microsoft","reference":"FYI7","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":8,"name":"Sony","reference":"FYI8","locale":"ja_JP","expirationTime":"2022-11-24 17:46:00+09"},{"id":9,"name":"Intel","reference":"FYI9","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":10,"name":"Cisco","reference":"FYI10","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":11,"name":"Dell","reference":"FYI11","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":12,"name":"Canonical","reference":"FYI12","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":13,"name":"UPS","reference":"FYI25","locale":"en_BE","expirationTime":"2013-10-03 12:18:46+01"}]
----

4
docs/getAllPartners/httpie-request.adoc

@ -0,0 +1,4 @@
[source,bash]
----
$ http GET 'http://localhost:8080/partners'
----

4
docs/getAllPartners/request-body.adoc

@ -0,0 +1,4 @@
[source,options="nowrap"]
----
----

4
docs/getAllPartners/response-body.adoc

@ -0,0 +1,4 @@
[source,options="nowrap"]
----
[{"id":1,"name":"B2boost","reference":"FYI1","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":2,"name":"Proximus","reference":"FYI2","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":3,"name":"KBC Bank","reference":"FYI3","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":4,"name":"AB InBev","reference":"FYI4","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":5,"name":"Spotify","reference":"FYI5","locale":"sv_SE","expirationTime":"2022-11-24 17:46:00+01"},{"id":6,"name":"AMSOM-Habitat","reference":"FYI6","locale":"fr_FR","expirationTime":"2022-11-24 17:46:00+01"},{"id":7,"name":"Microsoft","reference":"FYI7","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":8,"name":"Sony","reference":"FYI8","locale":"ja_JP","expirationTime":"2022-11-24 17:46:00+09"},{"id":9,"name":"Intel","reference":"FYI9","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":10,"name":"Cisco","reference":"FYI10","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":11,"name":"Dell","reference":"FYI11","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":12,"name":"Canonical","reference":"FYI12","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":13,"name":"UPS","reference":"FYI25","locale":"en_BE","expirationTime":"2013-10-03 12:18:46+01"}]
----

73
docs/partnerapi.adoc

@ -0,0 +1,73 @@
= Api partner for B2Boost
Doc Writer <https://art-dambrine.ovh [asciidoc @art-dambrine]>
:toc: left
:hide-uri-scheme:
:source-highlighter: highlight.js
== Framework and build tools
For this project I chose to use Spring Boot alongside Gradle.
== Purpose
Small assignment to assess your capacity to execute a specific request
It is taking into account some of the software engineering aspects beyond programming, like (non-exhaustive list):
- Packaging
- Layering
- Error management
- Documentation
- Deployment aspects
- Testing
This is a contrived example, especially designed to make the candidates exercise a deeper knowledge of the framework, going beyond simple tutorials that can be found online.
_Credits (Purpose section) : B2Boost_
== Api documentation
In the following document you will find a simple documentation of the API.
Most of the following sections have been generated with https://spring.io/projects/spring-restdocs[Spring Rest Docs].
=== Accessing all the partners GET
A `GET` request is used to access all the partners read.
==== Request structure
include::getAllPartners/http-request.adoc[]
==== Example response
include::getAllPartners/http-response.adoc[]
==== CURL request
include::getAllPartners/curl-request.adoc[]
=== Accessing the partner GET
A `GET` request is used to access the partner read.
==== Request structure
include::getAPartner/http-request.adoc[]
==== Path Parameters
include::getAPartner/path-parameters.adoc[]
==== Example response
include::getAPartner/http-response.adoc[]
==== CURL request
include::getAPartner/curl-request.adoc[]
=== Accessing the partner POST
A `POST` request is used to add a partners resource.
==== Request structure
include::createPartner/http-request.adoc[]
==== Example response
include::createPartner/http-response.adoc[]
==== CURL request
include::createPartner/curl-request.adoc[]
Loading…
Cancel
Save