Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pixel Humain
api
Commits
e0b2a997
Commit
e0b2a997
authored
Feb 21, 2019
by
Tony Emma
Browse files
Ajout de l'api actor, à tester
parent
9673c877
Changes
7
Hide whitespace changes
Inline
Side-by-side
ApiModule.php
View file @
e0b2a997
...
...
@@ -31,6 +31,7 @@ class ApiModule extends CWebModule
'eco.models.*'
,
'places.models.*'
,
'news.models.*'
,
'dda.models.*'
,
$this
->
id
.
'.models.*'
,
$this
->
id
.
'.components.*'
,
$this
->
id
.
'.messages.*'
,
...
...
components/ApiController.php
View file @
e0b2a997
...
...
@@ -33,6 +33,11 @@ class ApiController extends Controller
//'getuseridbymail' => array("href" => "/ph/api/getuseridbymail"),
//"updatefield" => array("href" => "/ph/api/person/updatefield"),
),
"activitypub"
=>
array
(
"get"
=>
array
(
"href"
=>
"/ph/api/activitypub/get"
,
"public"
=>
true
),
"actor"
=>
array
(
"href"
=>
"/ph/api/abc/person/actor"
,
"public"
=>
true
),
"webfinger"
=>
array
(
"href"
=>
"/.well-known/webfinger"
,
"public"
=>
true
)
),
"organization"
=>
array
(
"get"
=>
array
(
"href"
=>
"/ph/api/organization/get"
,
"public"
=>
true
),
/*"updatefield" => array("href" => "/ph/api/organization/updatefield"),
...
...
controllers/ActivitypubController.php
0 → 100644
View file @
e0b2a997
<?php
class
ActivitypubController
extends
ApiController
{
protected
function
beforeAction
(
$action
)
{
parent
::
initPage
();
return
parent
::
beforeAction
(
$action
);
}
public
function
actions
()
{
return
array
(
'get'
=>
'api.controllers.activitypub.GetAction'
,
'actor'
=>
'api.controllers.activitypub.ActorAction'
,
'webfinger'
=>
'api.controllers.activitypub.WebfingerAction'
);
}
}
\ No newline at end of file
controllers/activitypub/ActorAction.php
0 → 100644
View file @
e0b2a997
<?php
class
ActorAction
extends
CAction
{
public
function
run
(
$id
=
null
,
$format
=
null
,
$limit
=
1
,
$index
=
0
,
$tags
=
null
,
$multiTags
=
null
,
$key
=
null
,
$insee
=
null
)
{
$controller
=
$this
->
getController
();
$bindMap
=
(
!
empty
(
$id
)
?
TranslateActivityStream
::
$dataBinding_actor
:
null
);
$result
=
Api
::
getData
(
$bindMap
,
$format
,
Citoyen
::
COLLECTION
,
$id
,
$limit
,
$index
,
$tags
,
$multiTags
,
$key
,
$insee
);
Rest
::
json
(
$result
[
'entities'
][
$id
]);
Yii
::
app
()
->
end
();
}
}
controllers/activitypub/GetAction.php
0 → 100644
View file @
e0b2a997
<?php
class
GetAction
extends
CAction
{
public
function
run
(
$id
=
null
,
$format
=
null
,
$limit
=
50
,
$index
=
0
,
$tags
=
null
,
$multiTags
=
null
,
$key
=
null
,
$insee
=
null
)
{
$controller
=
$this
->
getController
();
if
(
$format
==
Translate
::
FORMAT_AS
)
$bindMap
=
(
empty
(
$id
)
?
TranslateActivityStream
::
$dataBinding_allActivityPub
:
null
);
else
$bindMap
=
(
empty
(
$id
)
?
TranslateCommunecter
::
$dataBinding_allActivityPub
:
TranslateCommunecter
::
$dataBinding_allActivity
);
$result
=
Api
::
getData
(
$bindMap
,
$format
,
ActivityStream
::
COLLECTION
,
$id
,
$limit
,
$index
,
$tags
,
$multiTags
,
$key
,
$insee
);
if
(
$format
==
Translate
::
FORMAT_KML
)
{
$strucKml
=
News
::
getStrucKml
();
Rest
::
xml
(
$result
,
$strucKml
,
$format
);
}
else
if
(
$format
==
Translate
::
FORMAT_MD
)
{
//header('Content-Type: text/markdown');
echo
$result
;
}
Rest
::
json
(
$result
);
Yii
::
app
()
->
end
();
}
}
\ No newline at end of file
controllers/activitypub/WebfingerAction.php
0 → 100644
View file @
e0b2a997
<?php
class
WebfingerAction
extends
CAction
{
public
function
run
(
$id
=
null
,
$format
=
null
,
$limit
=
1
,
$index
=
0
,
$tags
=
null
,
$multiTags
=
null
,
$key
=
null
,
$insee
=
null
){
$controller
=
$this
->
getController
();
$bindMap
=
(
!
empty
(
$id
)
?
TranslateActivityStream
::
$dataBinding_webfinger
:
null
);
$result
=
Api
::
getData
(
$bindMap
,
$format
,
ActivityStream
::
COLLECTION2
,
$id
,
$limit
,
$index
,
$tags
,
$multiTags
,
$key
,
$insee
);
Rest
::
json
(
$result
[
'entities'
][
$id
]);
}
}
\ No newline at end of file
data/api.json
View file @
e0b2a997
{
{
"swagger"
:
"2.0"
,
"info"
:
{
"version"
:
"0.0.1"
,
...
...
@@ -46,6 +46,13 @@
"type"
:
"string"
,
"required"
:
true
},
"activitypub-id"
:{
"name"
:
"activitypub-id"
,
"in"
:
"path"
,
"description"
:
"The Activity Pub identifier string"
,
"type"
:
"string"
,
"required"
:
true
},
"insee"
:
{
"name"
:
"insee"
,
"in"
:
"query"
,
...
...
@@ -97,6 +104,55 @@
}
},
"paths"
:
{
"/activitypub/get"
:
{
"get"
:
{
"tags"
:
[
"ActivityPub"
],
"parameters"
:
[
],
"description"
:
"Get information about all Activity Pub."
,
"responses"
:
{
"200"
:
{
"description"
:
"The list of Activity Pub."
,
"schema"
:
{
"type"
:
"object"
,
"properties"
:
{
"data"
:
{
"$ref"
:
"#/definitions/allActivitypub"
}
}
}
}
}
}
},
"/activitypub/get/id/{activitypub-id}"
:
{
"get"
:
{
"tags"
:
[
"ActivityPub"
],
"parameters"
:
[
{
"$ref"
:
"#/parameters/activitypub-id"
}
],
"description"
:
"Get information about a ActivityPub."
,
"responses"
:
{
"200"
:
{
"description"
:
"The ActivityPub object"
,
"schema"
:
{
"type"
:
"object"
,
"properties"
:
{
"data"
:
{
"$ref"
:
"#/definitions/activitypub"
}
}
}
}
}
}
},
"/person/get"
:
{
"get"
:
{
"tags"
:
[
...
...
@@ -124,7 +180,7 @@
"type"
:
"object"
,
"properties"
:
{
"data"
:
{
"$ref"
:
"#/definitions/all
Person
"
"$ref"
:
"#/definitions/all
Activitypub
"
}
}
}
...
...
@@ -435,6 +491,7 @@
}
}
},
"definitions"
:
{
"meta"
:
{
"type"
:
"object"
,
...
...
@@ -453,6 +510,82 @@
}
}
},
"allActivitypub"
:
{
"type"
:
"object"
,
"properties"
:
{
"meta"
:
{
"$ref"
:
"#/definitions/meta"
},
"entities"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"object"
,
"properties"
:
{
"@type"
:
{
"type"
:
"string"
,
"description"
:
"Type of element."
},
"verb"
:
{
"type"
:
"string"
,
"description"
:
"Type of verb."
},
"author"
:{
"$ref"
:
"#/definitions/author"
},
"url"
:
{
"$ref"
:
"#/definitions/url"
}
}
}
}
}
}
},
"activitypub"
:
{
"type"
:
"object"
,
"properties"
:
{
"meta"
:
{
"$ref"
:
"#/definitions/meta"
},
"entities"
:
{
"type"
:
"object"
,
"properties"
:
{
"id"
:
{
"type"
:
"object"
,
"properties"
:
{
"@type"
:
{
"type"
:
"string"
,
"description"
:
"Type of element."
},
"verb"
:
{
"type"
:
"string"
,
"description"
:
"Type of verb."
},
"author"
:{
"$ref"
:
"#/definitions/author"
},
"target"
:{
"$ref"
:
"#/definitions/target"
},
"scope"
:{
"type"
:
"string"
},
"object"
:{
"$ref"
:
"#/definitions/object"
},
"url"
:
{
"$ref"
:
"#/definitions/url"
},
"notify"
:{
"$ref"
:
"#/definitions/notify"
}
}
}
}
}
}
},
"allPerson"
:
{
"type"
:
"object"
,
"properties"
:
{
...
...
@@ -625,6 +758,62 @@
}
}
},
"author"
:{
"type"
:
"object"
,
"properties"
:{
"id"
:{
"type"
:
"string"
,
"description"
:
"id author"
},
"name"
:{
"type"
:
"string"
,
"description"
:
"name author"
}
}
},
"target"
:
{
"type"
:
"object"
,
"properties"
:{
"type"
:{
"type"
:
"string"
,
"description"
:
"type"
},
"id"
:{
"type"
:
"string"
,
"description"
:
"id target"
}
}
},
"object"
:
{
"type"
:
"object"
,
"properties"
:{
"displayName"
:{
"type"
:
"string"
,
"description"
:
"type"
},
"displayValue"
:{
"type"
:
"string"
,
"description"
:
"id target"
}
}
},
"notify"
:{
"type"
:
"object"
,
"properties"
:{
"objectType"
:{
"type"
:
"string"
,
"description"
:
"objectType notify"
},
"id"
:{
"type"
:
"string"
,
"description"
:
"id notify"
},
"displayName"
:{
"type"
:
"string"
,
"description"
:
"description notifiy"
}
}
},
"allOrganization"
:
{
"type"
:
"object"
,
"properties"
:
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment