Giter Club home page Giter Club logo

Comments (7)

kmacdonaO avatar kmacdonaO commented on June 25, 2024

Hi Travis, we actually have added a method to the SDK to do this and are preparing to publish it to GitHub. Here are two examples of usage:

`Examples
// get the id,name,type of all the items in the publishing channel
contentClient.graphql({
'query': '{ getItems(channelToken: "2834f431f8524ffa89dfb7fe77993284")
{ items { id name type } } }'
}).then(function (response) {
console.log(response);
});

// get the item slug with the corresponding id in a channel
contentClient.graphql({
'query': '{ getItem(id:"CORE51A353B7C6AA4EB29C74781FB418C93B",
channelToken:"546c6bdfe022455db92741407cccded3")
{ slug } }'
}).then(function (response) {
console.log(response);
});
`
do you think this will satisfy the requirements that you have?

from content-management-sdk.

tcaruth avatar tcaruth commented on June 25, 2024

Does your method support variables?

from content-management-sdk.

kmacdonaO avatar kmacdonaO commented on June 25, 2024

Yes, it does support variables - I spent some time today adding tests to validate variable usage. Usage in my test looks like:

const response = await sut.graphql({
      query: 'query ($itemId: ID, $channelToken: String) {getItem(id: $itemId, channelToken: $channelToken) {id}}',
      variables: {
        itemId: process.env.VALID_DIGITAL_ASSET_ID_BASIC,
        channelToken: process.env.CHANNEL_TOKEN_BASIC,
      },
    });

I have a few other tests to fix up and then I'll publish this to GitHub soon

from content-management-sdk.

tcaruth avatar tcaruth commented on June 25, 2024

Looks good to me. Once it's on GitHub, how long do you think OCM adoption will take?

from content-management-sdk.

kmacdonaO avatar kmacdonaO commented on June 25, 2024

The package has been published to npmjs now - are you consuming this SDK directly via your OCM service (e.g. for content layouts)?

from content-management-sdk.

tcaruth avatar tcaruth commented on June 25, 2024

from content-management-sdk.

kmacdonaO avatar kmacdonaO commented on June 25, 2024

We're working to unify the code that is published on the server with the github/npmjs codebase. The server code is much older though I think it does have a graphql method already which you can probably use.

from content-management-sdk.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.