Skip to content

API iteration #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 22, 2024
Merged

API iteration #290

merged 2 commits into from
Mar 22, 2024

Conversation

igalshilman
Copy link
Contributor

@igalshilman igalshilman commented Mar 22, 2024

This PR changes the following concepts:

  1. Adds a client suffix for the ctx.service / ctx.object
  2. simply the endpoint binding methods to a single endpoint.bind()
  3. make the handlers/objects creation more explicit.

Here is a creation/binding example:

const service = restate.service({
  name: "greeter",
  handlers: {
        greet: ..
  }
});    

export type Greeter = typeof service;

restate.endpoint().bind(service).listen()

And here is a call site:

import type {Greeter} from "...";

const Greeter: Greeter = { name : "greeter" };
...
await ctx.serviceClient(Greeter).greet();
...

Thanks @nikrooz and @gvdongen for the feedback!

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

@igalshilman
Copy link
Contributor Author

Note: the e2e are not expected to pass, as the API has changed.

@nikrooz
Copy link
Contributor

nikrooz commented Mar 22, 2024

thanks, looks great!

This commits changes the service/object creation from
positional arguments into object literals, this improves the readability
and opens the door for additional configurations (like visibility,
schema etc')
This change is based on a feedback round.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants