Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wb-rest-api-client

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wb-rest-api-client

Wikibase REST API Client

  • 0.9.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
0
Weekly downloads
 
Created
Source

@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( 'Q42', 'en' ) );

Below you can find the automatically generated documentation:

WbRestApiClient - JavaScript client for wb-rest-api-client OpenAPI definition of Wikibase REST API This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 0.5
  • Package version: 0.9.0
  • Generator version: 7.10.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://phabricator.wikimedia.org/project/board/6692/

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 wb-rest-api-client --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 wb-rest-api-client 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 WbRestApiClient = require('wb-rest-api-client');


var api = new WbRestApiClient.AliasesApi()
var itemId = "Q24"; // {String} The ID of the required Item
var languageCode = "en"; // {String} The requested resource language
var addItemAliasesInLanguageRequest = new WbRestApiClient.AddItemAliasesInLanguageRequest(); // {AddItemAliasesInLanguageRequest} Payload containing a list of Wikibase 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/v0

ClassMethodHTTP requestDescription
WbRestApiClient.AliasesApiaddItemAliasesInLanguagePOST /entities/items/{item_id}/aliases/{language_code}Create / Add an Item's aliases in a specific language
WbRestApiClient.AliasesApiaddPropertyAliasesInLanguagePOST /entities/properties/{property_id}/aliases/{language_code}Create / Add a Property's aliases in a specific language
WbRestApiClient.AliasesApigetItemAliasesGET /entities/items/{item_id}/aliasesRetrieve an Item's aliases
WbRestApiClient.AliasesApigetItemAliasesInLanguageGET /entities/items/{item_id}/aliases/{language_code}Retrieve an Item's aliases in a specific language
WbRestApiClient.AliasesApigetPropertyAliasesGET /entities/properties/{property_id}/aliasesRetrieve a Property's aliases
WbRestApiClient.AliasesApigetPropertyAliasesInLanguageGET /entities/properties/{property_id}/aliases/{language_code}Retrieve a Property's aliases in a specific language
WbRestApiClient.AliasesApipatchItemAliasesPATCH /entities/items/{item_id}/aliasesChange an Item's aliases
WbRestApiClient.AliasesApipatchPropertyAliasesPATCH /entities/properties/{property_id}/aliasesChange a Property's aliases
WbRestApiClient.DescriptionsApideleteItemDescriptionDELETE /entities/items/{item_id}/descriptions/{language_code}Delete an Item's description in a specific language
WbRestApiClient.DescriptionsApideletePropertyDescriptionDELETE /entities/properties/{property_id}/descriptions/{language_code}Delete a Property's description in a specific language
WbRestApiClient.DescriptionsApigetItemDescriptionGET /entities/items/{item_id}/descriptions/{language_code}Retrieve an Item's description in a specific language
WbRestApiClient.DescriptionsApigetItemDescriptionWithFallbackGET /entities/items/{item_id}/descriptions_with_language_fallback/{language_code}Retrieve an Item's description in a specific language, with language fallback
WbRestApiClient.DescriptionsApigetItemDescriptionsGET /entities/items/{item_id}/descriptionsRetrieve an Item's descriptions
WbRestApiClient.DescriptionsApigetPropertyDescriptionGET /entities/properties/{property_id}/descriptions/{language_code}Retrieve a Property's description in a specific language
WbRestApiClient.DescriptionsApigetPropertyDescriptionWithFallbackGET /entities/properties/{property_id}/descriptions_with_language_fallback/{language_code}Retrieve a Property's description in a specific language, with language fallback
WbRestApiClient.DescriptionsApigetPropertyDescriptionsGET /entities/properties/{property_id}/descriptionsRetrieve a Property's descriptions
WbRestApiClient.DescriptionsApipatchItemDescriptionsPATCH /entities/items/{item_id}/descriptionsChange an Item's descriptions
WbRestApiClient.DescriptionsApipatchPropertyDescriptionsPATCH /entities/properties/{property_id}/descriptionsChange a Property's descriptions
WbRestApiClient.DescriptionsApireplaceItemDescriptionPUT /entities/items/{item_id}/descriptions/{language_code}Add / Replace an Item's description in a specific language
WbRestApiClient.DescriptionsApireplacePropertyDescriptionPUT /entities/properties/{property_id}/descriptions/{language_code}Add / Replace a Property's description in a specific language
WbRestApiClient.ItemsApiaddItemPOST /entities/itemsCreate a Wikibase Item
WbRestApiClient.ItemsApigetItemGET /entities/items/{item_id}Retrieve a single Wikibase Item by ID
WbRestApiClient.ItemsApipatchItemPATCH /entities/items/{item_id}Change a single Wikibase Item by ID
WbRestApiClient.LabelsApideleteItemLabelDELETE /entities/items/{item_id}/labels/{language_code}Delete an Item's label in a specific language
WbRestApiClient.LabelsApideletePropertyLabelDELETE /entities/properties/{property_id}/labels/{language_code}Delete a Property's label in a specific language
WbRestApiClient.LabelsApigetItemLabelGET /entities/items/{item_id}/labels/{language_code}Retrieve an Item's label in a specific language
WbRestApiClient.LabelsApigetItemLabelWithFallbackGET /entities/items/{item_id}/labels_with_language_fallback/{language_code}Retrieve an Item's label in a specific language, with language fallback
WbRestApiClient.LabelsApigetItemLabelsGET /entities/items/{item_id}/labelsRetrieve an Item's labels
WbRestApiClient.LabelsApigetPropertyLabelGET /entities/properties/{property_id}/labels/{language_code}Retrieve a Property's label in a specific language
WbRestApiClient.LabelsApigetPropertyLabelWithFallbackGET /entities/properties/{property_id}/labels_with_language_fallback/{language_code}Retrieve a Property's label in a specific language, with language fallback
WbRestApiClient.LabelsApigetPropertyLabelsGET /entities/properties/{property_id}/labelsRetrieve a Property's labels
WbRestApiClient.LabelsApipatchItemLabelsPATCH /entities/items/{item_id}/labelsChange an Item's Labels
WbRestApiClient.LabelsApipatchPropertyLabelsPATCH /entities/properties/{property_id}/labelsChange a Property's Labels
WbRestApiClient.LabelsApireplaceItemLabelPUT /entities/items/{item_id}/labels/{language_code}Add / Replace an Item's label in a specific language
WbRestApiClient.LabelsApireplacePropertyLabelPUT /entities/properties/{property_id}/labels/{language_code}Add / Replace a Property's label in a specific language
WbRestApiClient.OpenAPIDocumentApigetOpenApiDocGET /openapi.jsonRetrieve the OpenAPI document
WbRestApiClient.PropertiesApiaddPropertyPOST /entities/properties[WIP] Create a Wikibase Property
WbRestApiClient.PropertiesApigetPropertyGET /entities/properties/{property_id}Retrieve a single Wikibase Property by ID
WbRestApiClient.PropertiesApipatchPropertyPATCH /entities/properties/{property_id}Change a single Wikibase Property by ID
WbRestApiClient.PropertyDataTypesApigetPropertyDataTypesGET /property-data-typesRetrieve the map of Property data types to value types
WbRestApiClient.SitelinksApideleteSitelinkDELETE /entities/items/{item_id}/sitelinks/{site_id}Delete an Item's Sitelink
WbRestApiClient.SitelinksApigetSitelinkGET /entities/items/{item_id}/sitelinks/{site_id}Retrieve an Item's Sitelink
WbRestApiClient.SitelinksApigetSitelinksGET /entities/items/{item_id}/sitelinksRetrieve an Item's Sitelinks
WbRestApiClient.SitelinksApipatchSitelinksPATCH /entities/items/{item_id}/sitelinksChange an Item's Sitelinks
WbRestApiClient.SitelinksApisetSitelinkPUT /entities/items/{item_id}/sitelinks/{site_id}Add / Replace an Item's Sitelink
WbRestApiClient.StatementsApiaddItemStatementPOST /entities/items/{item_id}/statementsAdd a new Statement to an Item
WbRestApiClient.StatementsApiaddPropertyStatementPOST /entities/properties/{property_id}/statementsAdd a new Statement to a Property
WbRestApiClient.StatementsApideleteItemStatementDELETE /entities/items/{item_id}/statements/{statement_id}Delete a single Statement from an Item
WbRestApiClient.StatementsApideletePropertyStatementDELETE /entities/properties/{property_id}/statements/{statement_id}Delete a single Statement from a Property
WbRestApiClient.StatementsApideleteStatementDELETE /statements/{statement_id}Delete a single Statement
WbRestApiClient.StatementsApigetItemStatementGET /entities/items/{item_id}/statements/{statement_id}Retrieve a single Statement from an Item
WbRestApiClient.StatementsApigetItemStatementsGET /entities/items/{item_id}/statementsRetrieve Statements from an Item
WbRestApiClient.StatementsApigetPropertyStatementGET /entities/properties/{property_id}/statements/{statement_id}Retrieve a single Statement from a Property
WbRestApiClient.StatementsApigetPropertyStatementsGET /entities/properties/{property_id}/statementsRetrieve Statements from a Property
WbRestApiClient.StatementsApigetStatementGET /statements/{statement_id}Retrieve a single Statement
WbRestApiClient.StatementsApipatchItemStatementPATCH /entities/items/{item_id}/statements/{statement_id}Change elements of a single Statement of an Item
WbRestApiClient.StatementsApipatchPropertyStatementPATCH /entities/properties/{property_id}/statements/{statement_id}Change elements of a single Statement of a Property
WbRestApiClient.StatementsApipatchStatementPATCH /statements/{statement_id}Change elements of a single Statement
WbRestApiClient.StatementsApireplaceItemStatementPUT /entities/items/{item_id}/statements/{statement_id}Replace a single Statement of an Item
WbRestApiClient.StatementsApireplacePropertyStatementPUT /entities/properties/{property_id}/statements/{statement_id}Replace a single Statement of a Property
WbRestApiClient.StatementsApireplaceStatementPUT /statements/{statement_id}Replace a single Statement

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.

FAQs

Package last updated on 25 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc