npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wmde/wikibase-rest-api

v1.1.1

Published

Wikibase REST API Client

Downloads

23

Readme

@wmde/wikibase-rest-api

This is an auto-generated Wikibase REST API client library using the API’s OpenAPI document. It is generated via OpenAPITools/openapi-generator and WMDE does not provide any guarantees about the library functionality.

Usage

This snippet shows a basic usage example, including how to set the User-Agent header, which should be configured according to the Wikimedia User-Agent policy.

import { ApiClient, LabelsApi } from '@wmde/wikibase-rest-api';

const apiClient = new ApiClient( 'https://www.wikidata.org/w/rest.php/wikibase/v0' );
apiClient.defaultHeaders[ 'User-Agent' ] = '[custom user agent]';

console.log( await new LabelsApi( apiClient ).getItemLabel( 'Q1', 'en' ) );

Below you can find the automatically generated documentation:

WmdeWikibaseRestApi - JavaScript client for @wmde/wikibase-rest-api OpenAPI definition of Wikibase REST API This SDK is automatically generated by the OpenAPI Generator project:

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install @wmde/wikibase-rest-api --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your @wmde/wikibase-rest-api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var WmdeWikibaseRestApi = require('@wmde/wikibase-rest-api');


var api = new WmdeWikibaseRestApi.AliasesApi()
var itemId = "Q24"; // {String} The ID of the required Item
var languageCode = "en"; // {String} The requested resource language
var addItemAliasesInLanguageRequest = {"aliases":["JD"],"tags":[],"bot":false,"comment":"Add English alias"}; // {AddItemAliasesInLanguageRequest} Payload containing a list of Item aliases in the specified language and edit metadata
var opts = {
  'ifNoneMatch': ["null"], // {[String]} Conditionally perform the request only if the resource has been modified since the specified entity revision numbers
  'ifModifiedSince': "Sat, 06 Jun 2020 16:38:47 GMT", // {String} Conditionally perform the request only if the resource has been modified after the specified date
  'ifMatch': ["null"], // {[String]} Conditionally perform the request only if the resource has not been modified since one of the specified entity revision numbers
  'ifUnmodifiedSince': "Sat, 06 Jun 2020 16:38:47 GMT", // {String} Conditionally perform the request only if the resource has not been modified after the specified date
  'authorization': "Bearer mF_9.B5f-4.1JqM" // {String} Make authenticated request using a provided bearer token
};
api.addItemAliasesInLanguage(itemId, languageCode, addItemAliasesInLanguageRequest, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://wikibase.example/w/rest.php/wikibase/v1

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- WmdeWikibaseRestApi.AliasesApi | addItemAliasesInLanguage | POST /entities/items/{item_id}/aliases/{language_code} | Create / Add an Item's aliases in a specific language WmdeWikibaseRestApi.AliasesApi | addPropertyAliasesInLanguage | POST /entities/properties/{property_id}/aliases/{language_code} | Create / Add a Property's aliases in a specific language WmdeWikibaseRestApi.AliasesApi | getItemAliases | GET /entities/items/{item_id}/aliases | Retrieve an Item's aliases WmdeWikibaseRestApi.AliasesApi | getItemAliasesInLanguage | GET /entities/items/{item_id}/aliases/{language_code} | Retrieve an Item's aliases in a specific language WmdeWikibaseRestApi.AliasesApi | getPropertyAliases | GET /entities/properties/{property_id}/aliases | Retrieve a Property's aliases WmdeWikibaseRestApi.AliasesApi | getPropertyAliasesInLanguage | GET /entities/properties/{property_id}/aliases/{language_code} | Retrieve a Property's aliases in a specific language WmdeWikibaseRestApi.AliasesApi | patchItemAliases | PATCH /entities/items/{item_id}/aliases | Change an Item's aliases WmdeWikibaseRestApi.AliasesApi | patchPropertyAliases | PATCH /entities/properties/{property_id}/aliases | Change a Property's aliases WmdeWikibaseRestApi.DescriptionsApi | deleteItemDescription | DELETE /entities/items/{item_id}/descriptions/{language_code} | Delete an Item's description in a specific language WmdeWikibaseRestApi.DescriptionsApi | deletePropertyDescription | DELETE /entities/properties/{property_id}/descriptions/{language_code} | Delete a Property's description in a specific language WmdeWikibaseRestApi.DescriptionsApi | getItemDescription | GET /entities/items/{item_id}/descriptions/{language_code} | Retrieve an Item's description in a specific language WmdeWikibaseRestApi.DescriptionsApi | getItemDescriptionWithFallback | GET /entities/items/{item_id}/descriptions_with_language_fallback/{language_code} | Retrieve an Item's description in a specific language, with language fallback WmdeWikibaseRestApi.DescriptionsApi | getItemDescriptions | GET /entities/items/{item_id}/descriptions | Retrieve an Item's descriptions WmdeWikibaseRestApi.DescriptionsApi | getPropertyDescription | GET /entities/properties/{property_id}/descriptions/{language_code} | Retrieve a Property's description in a specific language WmdeWikibaseRestApi.DescriptionsApi | getPropertyDescriptionWithFallback | GET /entities/properties/{property_id}/descriptions_with_language_fallback/{language_code} | Retrieve a Property's description in a specific language, with language fallback WmdeWikibaseRestApi.DescriptionsApi | getPropertyDescriptions | GET /entities/properties/{property_id}/descriptions | Retrieve a Property's descriptions WmdeWikibaseRestApi.DescriptionsApi | patchItemDescriptions | PATCH /entities/items/{item_id}/descriptions | Change an Item's descriptions WmdeWikibaseRestApi.DescriptionsApi | patchPropertyDescriptions | PATCH /entities/properties/{property_id}/descriptions | Change a Property's descriptions WmdeWikibaseRestApi.DescriptionsApi | replaceItemDescription | PUT /entities/items/{item_id}/descriptions/{language_code} | Add / Replace an Item's description in a specific language WmdeWikibaseRestApi.DescriptionsApi | setPropertyDescription | PUT /entities/properties/{property_id}/descriptions/{language_code} | Add / Replace a Property's description in a specific language WmdeWikibaseRestApi.ItemsApi | addItem | POST /entities/items | Create a Wikibase Item WmdeWikibaseRestApi.ItemsApi | getItem | GET /entities/items/{item_id} | Retrieve a single Wikibase Item by ID WmdeWikibaseRestApi.ItemsApi | patchItem | PATCH /entities/items/{item_id} | Change a single Wikibase Item by ID WmdeWikibaseRestApi.LabelsApi | deleteItemLabel | DELETE /entities/items/{item_id}/labels/{language_code} | Delete an Item's label in a specific language WmdeWikibaseRestApi.LabelsApi | deletePropertyLabel | DELETE /entities/properties/{property_id}/labels/{language_code} | Delete a Property's label in a specific language WmdeWikibaseRestApi.LabelsApi | getItemLabel | GET /entities/items/{item_id}/labels/{language_code} | Retrieve an Item's label in a specific language WmdeWikibaseRestApi.LabelsApi | getItemLabelWithFallback | GET /entities/items/{item_id}/labels_with_language_fallback/{language_code} | Retrieve an Item's label in a specific language, with language fallback WmdeWikibaseRestApi.LabelsApi | getItemLabels | GET /entities/items/{item_id}/labels | Retrieve an Item's labels WmdeWikibaseRestApi.LabelsApi | getPropertyLabel | GET /entities/properties/{property_id}/labels/{language_code} | Retrieve a Property's label in a specific language WmdeWikibaseRestApi.LabelsApi | getPropertyLabelWithFallback | GET /entities/properties/{property_id}/labels_with_language_fallback/{language_code} | Retrieve a Property's label in a specific language, with language fallback WmdeWikibaseRestApi.LabelsApi | getPropertyLabels | GET /entities/properties/{property_id}/labels | Retrieve a Property's labels WmdeWikibaseRestApi.LabelsApi | patchItemLabels | PATCH /entities/items/{item_id}/labels | Change an Item's Labels WmdeWikibaseRestApi.LabelsApi | patchPropertyLabels | PATCH /entities/properties/{property_id}/labels | Change a Property's Labels WmdeWikibaseRestApi.LabelsApi | replaceItemLabel | PUT /entities/items/{item_id}/labels/{language_code} | Add / Replace an Item's label in a specific language WmdeWikibaseRestApi.LabelsApi | replacePropertyLabel | PUT /entities/properties/{property_id}/labels/{language_code} | Add / Replace a Property's label in a specific language WmdeWikibaseRestApi.OpenAPIDocumentApi | getOpenApiDoc | GET /openapi.json | Retrieve the OpenAPI document WmdeWikibaseRestApi.PropertiesApi | addProperty | POST /entities/properties | Create a Wikibase Property WmdeWikibaseRestApi.PropertiesApi | getProperty | GET /entities/properties/{property_id} | Retrieve a single Wikibase Property by ID WmdeWikibaseRestApi.PropertiesApi | patchProperty | PATCH /entities/properties/{property_id} | Change a single Wikibase Property by ID WmdeWikibaseRestApi.PropertyDataTypesApi | getPropertyDataTypes | GET /property-data-types | Retrieve the map of Property data types to value types WmdeWikibaseRestApi.SitelinksApi | deleteSitelink | DELETE /entities/items/{item_id}/sitelinks/{site_id} | Delete an Item's Sitelink WmdeWikibaseRestApi.SitelinksApi | getSitelink | GET /entities/items/{item_id}/sitelinks/{site_id} | Retrieve an Item's Sitelink WmdeWikibaseRestApi.SitelinksApi | getSitelinks | GET /entities/items/{item_id}/sitelinks | Retrieve an Item's Sitelinks WmdeWikibaseRestApi.SitelinksApi | patchSitelinks | PATCH /entities/items/{item_id}/sitelinks | Change an Item's Sitelinks WmdeWikibaseRestApi.SitelinksApi | setSitelink | PUT /entities/items/{item_id}/sitelinks/{site_id} | Add / Replace an Item's Sitelink WmdeWikibaseRestApi.StatementsApi | addItemStatement | POST /entities/items/{item_id}/statements | Add a new Statement to an Item WmdeWikibaseRestApi.StatementsApi | addPropertyStatement | POST /entities/properties/{property_id}/statements | Add a new Statement to a Property WmdeWikibaseRestApi.StatementsApi | deleteItemStatement | DELETE /entities/items/{item_id}/statements/{statement_id} | Delete a single Statement from an Item WmdeWikibaseRestApi.StatementsApi | deletePropertyStatement | DELETE /entities/properties/{property_id}/statements/{statement_id} | Delete a single Statement from a Property WmdeWikibaseRestApi.StatementsApi | deleteStatement | DELETE /statements/{statement_id} | Delete a single Statement WmdeWikibaseRestApi.StatementsApi | getItemStatement | GET /entities/items/{item_id}/statements/{statement_id} | Retrieve a single Statement from an Item WmdeWikibaseRestApi.StatementsApi | getItemStatements | GET /entities/items/{item_id}/statements | Retrieve Statements from an Item WmdeWikibaseRestApi.StatementsApi | getPropertyStatement | GET /entities/properties/{property_id}/statements/{statement_id} | Retrieve a single Statement from a Property WmdeWikibaseRestApi.StatementsApi | getPropertyStatements | GET /entities/properties/{property_id}/statements | Retrieve Statements from a Property WmdeWikibaseRestApi.StatementsApi | getStatement | GET /statements/{statement_id} | Retrieve a single Statement WmdeWikibaseRestApi.StatementsApi | patchItemStatement | PATCH /entities/items/{item_id}/statements/{statement_id} | Change elements of a single Statement of an Item WmdeWikibaseRestApi.StatementsApi | patchPropertyStatement | PATCH /entities/properties/{property_id}/statements/{statement_id} | Change elements of a single Statement of a Property WmdeWikibaseRestApi.StatementsApi | patchStatement | PATCH /statements/{statement_id} | Change elements of a single Statement WmdeWikibaseRestApi.StatementsApi | replaceItemStatement | PUT /entities/items/{item_id}/statements/{statement_id} | Replace a single Statement of an Item WmdeWikibaseRestApi.StatementsApi | replacePropertyStatement | PUT /entities/properties/{property_id}/statements/{statement_id} | Replace a single Statement of a Property WmdeWikibaseRestApi.StatementsApi | replaceStatement | PUT /statements/{statement_id} | Replace a single Statement

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.