Skip to content

Commit

Permalink
solve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvdries committed Jul 27, 2017
2 parents b9cddcf + 5e49266 commit 3979abe
Show file tree
Hide file tree
Showing 14 changed files with 560 additions and 30 deletions.
1 change: 1 addition & 0 deletions backend/app/Http/Controllers/EntitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class EntitiesController extends Controller {

public function getHandles($entity_id)
{

$handles = Entity::findOrFail($entity_id)->handles;


Expand Down
1 change: 1 addition & 0 deletions backend/app/Http/Controllers/RESTActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function put(Request $request, $id)
{
$m = self::MODEL;
$this->validate($request, $m::$rules);


$model = $m::findOrFail($id);

Expand Down
35 changes: 35 additions & 0 deletions backend/docs/routes/GET_ZEN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Zen

GET /api/v1/zen

## Description

Returns an IT Joke. This endpoint is used to test the connectivity of the API.

## Parameters

## Return format

A JSON Object filled with:

* joke — The joke

## Errors


## Example

### **Request**

``` json

GET /api/v1/zen
```

### **Return**

``` json
{
joke: "Waiting for the joke. It' comming ...."
}
```
53 changes: 53 additions & 0 deletions backend/docs/routes/entities/GET_ENTITIES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Entity Resource

GET /entities

## Description

Returns a listing of all entities.

## Parameters

None

## Return format

A JSON Object filled an array of entity following the **[entity format][]**.

## Errors

None

## Example

### **Request**

``` json

GET /entities
```

### **Return**

``` json
[
{
id: 12,
name: "osoc17",
url: "entities_osoc17",
image: "http://2017.summerofcode.be/images/squarelogo-LI.png",
created_at: "2017-07-16 16:04:10",
updated_at: "2017-07-19 20:21:34"
},
{
id: 23,
name: "crypto blockchain",
url: "entities-crypto-blockchain",
image: null,
created_at: "2017-07-01 16:35:18",
updated_at: "2017-07-13 09:21:57"
}
]
```

[entity format]: ../../formats.md#short-format-entity
67 changes: 67 additions & 0 deletions backend/docs/routes/entities/GET_ENTITIES_id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Entity Resource

GET /entities/{id}

## Description

Returns a specified **[entity format][]**.

## Parameters

- **id**[integer] The id of the specified **[entity format][]**.


## Return format

A JSON Object filled with an entity following the **[entity format][]**.

## Errors

All errors return an HTTP error response with a JSON Object as keys ``message`` about the error, ``request.method`` the method of the received request, ``request.path`` the path used to send the request, ``request.input`` an array containing the parameters sent.

- **404 Not Found** — An Entity with the specified ID does not exist.

## Example

### **Request**

``` json
GET /entities/12
```

### **Return**

``` json
{
id: 12,
name: "osoc17",
url: "entities_osoc17",
image: "http://2017.summerofcode.be/images/squarelogo-LI.png",
created_at: "2017-07-16 16:04:10",
updated_at: "2017-07-19 20:21:34"
}

```

### **Wrong Request**

``` json
GET /entities/abc
```

### **Error Response**

``` json
{
message: "The requested object is not valid",
request: {
method: "GET",
path: "api/v1/entities/abc",
parameters: [ ]
},
data: [ ]
}
```


[entity format]: ../../formats.md#short-format-entity
126 changes: 126 additions & 0 deletions backend/docs/routes/formats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Resources Format

This document details all resources retrievable via the API.

## Base

All request for the API must be prefix by ``/api/v1``.


## Error Format

All errors return an HTTP error response with a JSON Object as keys ``message`` about the error, ``request.method`` the method of the received request, ``request.path`` the path used to send the request, ``request.input`` an array containing the parameters sent.

``` json
{
message: "The requested object is not valid",
request: {
method: "GET",
path: "api/v1/handle/lorem-ipsum",
parameters: [ ]
},
data: [ ]
}
```

## Default Service

List of the default service available.

|ID | Name| Link | Logo |Color
---|----|-------|-------|--------
|1 | Facebook| https://facebook.com| none| Blue
|2 | Twitter | https://twitter.com| none| Cyan
|3 | Youtube | https://youtube.com| none| Red
|4 | Google+ | https://plus.google.com | none | White
|5 | Instagram|https://instagram.com| none| Gray


## User format

A User is

The format of a User object includes the following data:

- **id**[integer] ID of the user.
- **email**[string] The email of the user.
- **fullname**[string] The surname and/or lastname of the user.
- **username**[string] The username of the user.
- **type**[enum(admin,**visitor**)] The username of the user.

## Entity format

A Entity is

The format of a Entity object includes the following data:

- **id**[integer] ID of the entity,
- **name**[string] Name of the entity
- **url**[string] URL of the entity
- **image**[string] The visual represention of the entity. Upload or fetched from the
- **created_at**[timestamp] Timestamp of time of entity creation
- **updated_at**[timestamp] Timestamp of time of entity last update.

## Handle format

A Handle is

The format of a Handle object includes the following data:

- **id**[integer] ID of the handle,
- **name**[string] Name of the handle
- **url**[string] URL of the handle
- **created_at**[timestamp] Timestamp of time of handle' creation
- **updated_at**[timestamp] Timestamp of time of handle' last update.
- **fetched_at**[timestamp] Timestamp of time of handle' last fetch.
- **is_fetching**[bit] Timestamp of time of handle last update.
- **entity_id**[integer] The ID of the attached **[Entity][]**.
- **service_id**[integer] The ID of the attached **[Service][]**:
- **provider_id**[integer] The ID of the attached **[Provider][]**:

## Service format

A Service is

The format of a Service object includes the following data:

- **id**[integer] ID of the service.
- **name**[string] Name of the service.
- **link**[string] The link to website of the service.
- **logo**[string] The Link of the representing' logo of the service.
- **color**[string] The color assigned to this service for the rending.
- **created_at**[timestamp] Timestamp of time of service creation

## Provider format

A Provider is

The format of a Provider object includes the following data:

- **id**[integer] ID of the provider.
- **social_id**[string] The ID assigned on the social media
- **email**[string] The email of the user.
- **fullname**[string] The surname and/or lastname of the user.
- **username**[string] The username of the user.

## Fetcher format

A Fetcher is

The format of a Fetcher object includes the following data:

- **id**[integer] ID of the provider.
- **data**[json] The Data of the
- **handle_id**[integer] The ID of the attached **[Handle][]**.




[entity]:[entity-format]
[service]:[service-format]
[handle]:[handle-format]
[provider]:[provider-format]

[Category]: https://github.com/500px/api-documentation/blob/master/basics/formats_and_terms.md#categories
[gallery kind]: https://github.com/500px/api-documentation/blob/master/basics/formats_and_terms.md#gallery-kinds
[License type]: https://github.com/500px/api-documentation/blob/master/basics/formats_and_terms.md#license_types
67 changes: 67 additions & 0 deletions backend/docs/routes/handles/GET_ENTITIEs_url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Entity Resource

GET /entities/{url}

## Description

Returns a specified **[entity format][]**.

## Parameters

- **URL**[string] The URL of the specified **[entity format][]**.


## Return format

A JSON Object filled with an entity following the **[entity format][]**.

## Errors

All errors return an HTTP error response with a JSON Object as keys ``message`` about the error, ``request.method`` the method of the received request, ``request.path`` the path used to send the request, ``request.input`` an array containing the parameters sent.

- **404 Not Found** — An Entity with the specified URL does not exist.

## Example

### **Request**

``` json
GET /entities/entities_osoc17
```

### **Return**

``` json
{
id: 12,
name: "osoc17",
url: "entities_osoc17",
image: "http://2017.summerofcode.be/images/squarelogo-LI.png",
created_at: "2017-07-16 16:04:10",
updated_at: "2017-07-19 20:21:34"
}

```

### **Wrong Request**

``` json
GET /entities/lorem-ipsum
```

### **Error Response**

``` json
{
message: "The requested object is not valid",
request: {
method: "GET",
path: "api/v1/entities/lorem-ipsum",
parameters: [ ]
},
data: [ ]
}
```


[entity format]: ../../formats.md#short-format-entity
Loading

0 comments on commit 3979abe

Please sign in to comment.