maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
226 stars 24 forks source link

include write operations #11

Closed maxlath closed 6 years ago

maxlath commented 8 years ago

As pointed here, wikidata-cli doesn't offer write operations such as adding a claim to an entity and alikes.

I see two possible paths to get there:

nichtich commented 8 years ago

Write operations should not require a local server but store access token at a file. Aren't there any pure JavaScript Wikidata edit applications yet?!

On 29. August 2016 10:52:53 MESZ, "Maxime Lathuilière" notifications@github.com wrote:

As pointed here, wikidata-cli doesn't offer write operations such as adding a claim to an entity and alikes.

I see two possible paths to get there:

  • integrate wikidata-agent
  • modularize wikidata-agent to use directly its logic without the server wrapper

You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/maxlath/wikidata-cli/issues/11

Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

maxlath commented 8 years ago

not that I'm aware of

The motivation for a server was to make edits with curl as simple as

curl -X POST http://localhost:4115/claim -d 'entity=Q4115189&property=P2002&value=Zorg'
nichtich commented 8 years ago

I'd move the backend of wikidata-agent (directory lib) into wikidata-sdk to extend the latter with write operations. Parts of wikidata-toolkit may be useful to look at, but a thin, opiniated wrapper on top of the API is enough. For instance:

var agent = wdk.agent({ bot: 1, ...}) // general settings, including wikidata-token
item = { id: "Q123", revision: "..." } // optionally include revision. Should also support plain id
agent.setLabel(item, language, value, summary)
agent.setDescription(item, language, value, summary)
agent.setAliases(item, language, aliases, summary)
agent.addAliases(item, language, aliases, summary)
agent.removeAliases(item, language, aliases, summary)
agent.setSitelink(item, site, title, summary)
agent.addClaim(item, property, value, summary)
agent.setClaim(claim, property, value, index, summary)
agent.removeClaim(claim, summary)
agent.setQualifier(claim, property, value, summary)
...
maxlath commented 8 years ago

existing options to store the credentials:

maxlath commented 7 years ago

Write operation are coming! thank to wikidata-edit, which is basically an extraction of the work done on wikidata-agent into a separate module.

For the config to persistent credentials, I went for a simple json file

maxlath commented 6 years ago

done: write operations documentation