Git Product home page Git Product logo

Comments (3)

bdemers avatar bdemers commented on August 19, 2024 1

Hey @AlainODea!

We are not likely to implement the Events API in the new SDKs as this endpoint is being replaced by the Logs API. It will be a while before this effect any apps in production (See the noticed on https://developer.okta.com/docs/api/resources/events):

However, the workaround looks something like this

client.getDataStore().getResource("/api/v1/events", EventsList.class).stream()
                .forEach(event -> {
                    System.out.println(event);
                });

and your resource classes:

public class Event extends AbstractResource {

        public Event(InternalDataStore dataStore) {
            super(dataStore);
        }

        public Event(InternalDataStore dataStore, Map<String, Object> properties) {
            super(dataStore, properties);
        }

        @Override
        public Map<String, Property> getPropertyDescriptors() {
            return createPropertyDescriptorMap();
        }
    }
    public class EventsList extends AbstractCollectionResource<Event> {

        private static final ArrayProperty<Event> ITEMS = new ArrayProperty<>("items", Event.class);

        public EventsList(InternalDataStore dataStore) {
            super(dataStore);
        }

        public EventsList(InternalDataStore dataStore, Map<String, Object> properties) {
            super(dataStore, properties);
        }

        public EventsList(InternalDataStore dataStore, Map<String, Object> properties, Map<String, Object> queryParams) {
            super(dataStore, properties, queryParams);
        }

        @Override
        public Map<String, Property> getPropertyDescriptors() {
            return createPropertyDescriptorMap(ITEMS);
        }

        @Override
        protected Class<Event> getItemType() {
            return Event.class;
        }
    }

Since, many of the current endpoints were generated, we didn't notice there is some code that could be be moved up into a parent class (getItemType, getPropertyDescriptors of the CollectionResource) opened: #183

One downside is this requires a compile dependency on the okta-sdk-impl module (not the end of the world, but worth pointing out)

And in my example the Event Object must be treated as a map, this was done to keep the example brief, but you could implement typed getters for the values you expected.

I'm going to close this issue, but your feedback is welcome on this suggestion!

from okta-sdk-java.

AlainODea avatar AlainODea commented on August 19, 2024

@bdemers this is the logging API we are using in production. We can't migrate to the new style of SDK until this is in it.

from okta-sdk-java.

AlainODea avatar AlainODea commented on August 19, 2024

Thank you very much for the detailed workaround, @bdemers. I’ll give that a shot!

from okta-sdk-java.

Related Issues (20)

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.