aboutsummaryrefslogtreecommitdiff
path: root/lib/response
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-08-18 23:54:32 +0200
committerChristian Weiske <cweiske@cweiske.de>2014-08-18 23:54:32 +0200
commitdb2f09d46ce2f3a46be1b6f6e031492966242025 (patch)
tree4e22eba650c022936a4071afd9b2b0ee417ad34b /lib/response
parent3780cf15a59c48b3d71e8ec27e3bdacd8a119460 (diff)
downloadgrauphel-db2f09d46ce2f3a46be1b6f6e031492966242025.tar.gz
grauphel-db2f09d46ce2f3a46be1b6f6e031492966242025.zip
oauth dance works
Diffstat (limited to 'lib/response')
-rw-r--r--lib/response/errorresponse.php20
-rw-r--r--lib/response/formresponse.php20
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/response/errorresponse.php b/lib/response/errorresponse.php
new file mode 100644
index 0000000..b72224f
--- /dev/null
+++ b/lib/response/errorresponse.php
@@ -0,0 +1,20 @@
+<?php
+namespace OCA\Grauphel\Lib\Response;
+
+class ErrorResponse extends \OCP\AppFramework\Http\Response
+{
+ protected $error;
+
+ public function __construct($error)
+ {
+ $this->setStatus(\OCP\AppFramework\Http::STATUS_BAD_REQUEST);
+ $this->addHeader('Content-Type', 'text/plain; charset=utf-8');
+ $this->error = $error;
+ }
+
+ public function render()
+ {
+ return $this->error . "\n";
+ }
+}
+?>
diff --git a/lib/response/formresponse.php b/lib/response/formresponse.php
new file mode 100644
index 0000000..e7ce33d
--- /dev/null
+++ b/lib/response/formresponse.php
@@ -0,0 +1,20 @@
+<?php
+namespace OCA\Grauphel\Lib\Response;
+
+class FormResponse extends \OCP\AppFramework\Http\Response
+{
+ protected $data;
+
+ public function __construct($data)
+ {
+ $this->setStatus(\OCP\AppFramework\Http::STATUS_OK);
+ $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');
+ $this->data = $data;
+ }
+
+ public function render()
+ {
+ return http_build_query($this->data, null, '&');
+ }
+}
+?>