Page MenuHomePhabricator

Implement countdown.search and countdown.edit
ClosedPublic

Authored by amckinley on Apr 13 2017, 7:18 PM.

Details

Summary

adds new conduit methods for countdown.edit and countdown.search

Test Plan

Search:

1[amckinley phabricator]$ echo '{"queryKey": "upcoming"}' | arc call-conduit --conduit-uri http://local.phacility.com/ --conduit-token <snip> countdown.search | json_pp
2{
3 "error" : null,
4 "errorMessage" : null,
5 "response" : {
6 "cursor" : {
7 "order" : null,
8 "before" : null,
9 "limit" : 100,
10 "after" : null
11 },
12 "maps" : [],
13 "query" : {
14 "queryKey" : "upcoming"
15 },
16 "data" : [
17 {
18 "phid" : "PHID-CDWN-nqqj6rv6iyaq5s4nt3z3",
19 "fields" : {
20 "spacePHID" : null,
21 "dateModified" : 1492110524,
22 "title" : "foobar",
23 "epoch" : "1492114080",
24 "policy" : {
25 "view" : "users",
26 "edit" : "users"
27 },
28 "dateCreated" : 1492110524,
29 "description" : "testing 123"
30 },
31 "attachments" : [],
32 "type" : "CDWN",
33 "id" : 7
34 }
35 ]
36 }
37}

Edit:
1[amckinley phabricator]$ echo '{"objectIdentifier": "PHID-CDWN-nqqj6rv6iyaq5s4nt3z3", "transactions": [{"type": "name", "value": "Assemble in the barnyard"}]}' | arc call-conduit --conduit-uri http://local.phacility.com/ --conduit-token <snip> countdown.edit | json_pp
2{
3 "response" : {
4 "object" : {
5 "id" : "7",
6 "phid" : "PHID-CDWN-nqqj6rv6iyaq5s4nt3z3"
7 },
8 "transactions" : []
9 },
10 "errorMessage" : null,
11 "error" : null
12}

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

amckinley created this revision.Apr 13 2017, 7:18 PM
epriestley accepted this revision.Apr 13 2017, 7:30 PM
epriestley added inline comments.
src/applications/countdown/storage/PhabricatorCountdown.php
175

Add a specification for epoch here too (for now, this is only used to generate documentation).

181

For remarkup fields like this, I started doing something to try to future-proof them recently in D17603:

  • Annotate the type as remarkup.
  • Return a dictionary with the raw value in 'raw'.

See also discussion in T12461. But the idea is that we might eventually want to be able to return text/html for these fields, or store other flavors of markdown, and we can do that without breaking the API if we emit a dictionary.

So the output is currently:

"description": "asdf"

...but for consistency with the new scheme in D17603, should be:

"description": {
  "raw": "asdf"
}
182

Put an (int) cast on this so it emits into JSON as a number instead of a string (PHP is all loosey-goosey about this stuff and we currently don't try to enforce types when they come out of the database).

That is, the output currently shows:

"epoch": "19831981098"

...but better is:

"epoch": 19831981098

...so that languages which care more will have an easier time interacting with the API.

This revision is now accepted and ready to land.Apr 13 2017, 7:30 PM
amckinley marked 2 inline comments as done.Apr 13 2017, 7:46 PM
amckinley added inline comments.
src/applications/countdown/storage/PhabricatorCountdown.php
175

Should the type be int or integer?

epriestley added inline comments.Apr 13 2017, 7:47 PM
src/applications/countdown/storage/PhabricatorCountdown.php
175

I think I've been using 'epoch' -- it's purely documentation for humans for now so it's kind of made up.

amckinley updated this revision to Diff 42521.Apr 13 2017, 7:55 PM

requested changes

This revision was automatically updated to reflect the committed changes.