Eiji

Eiji

ExApi is a library that I’m developing now and hope release soon
This library will allow to:

  1. list all apis
  2. list all api implementations
  3. fetch default implementation (if specified)
  4. list all api features
  5. list all supported features for implementation
  6. list all not available features for implementation
  7. list all not implemented features for implementation
  8. call feature from api using implementation id
  9. call feature from api using default implementation
  10. call feature deirectly on implementation (for example firstly get default implementation and then call feature on it)

Showing Posts 1 to 10

aseigo

aseigo

Elixir module APIs, or web APIs? (Sorry for the stupid questions :slight_smile: )

Eiji

Eiji OP

@aseigo: no problem, I don’t described this library yet

This library will allow you to declare api/implementation/feature similarly to protocol/implementation/function. My implementations are identified by atom and all will be fully dynamically. For example you could register api or implementation when you want (dynamically loaded files), so you load Elixir code on yourself and call register specified module … and there is much more …

aseigo

aseigo

Aha! I see. Thanks for the explanation. Sounds very neat, I will check it out for sure when it is released!

OvermindDL1

OvermindDL1

Sounds like a plugin system then eh? :slight_smile:

Eiji

Eiji OP

@OvermindDL1: hmm, at least it’s not intended

I’m using GenServer that in init function reads configuration and automatically initializes apis and their implementations saving them to state. I added extra possibility to register api and implementation at runtime, because you wrote that it could be useful. As you said scanning beam files is not so easy as it originally looks, so what you need to do is just load something (beam file json, or somethimg else) and fetch/generate from them api and implementations definitions. Finally you need only to register them. I have also one extra feature: when some async calls (like registration api or implementation) are executed asynchronously then ExApi dispatch event using ^Register.dispatch/2.

OvermindDL1

OvermindDL1

I’d been meaning to make a plugin API for elixir, I was thinking of doing a registration and just letting plugins that get loaded into the system register themselves into it.

Sounds cool though. Looking forward. :slight_smile:

Eiji

Eiji OP

@OvermindDL1: As soon as you can compile file with my library as dependency (especially macros) then you can register them. Of course name your api how you would like. API could be named MyApp.Plugin and then you can write MyApp.Loader that simply compiles file, gets file name (as plugin identificator) and register that plugin as a MyApp.Plugin implementation.

I’m making this firstly because I don’t want to implement protocol for empty structs that does not look good - at least for me.

OvermindDL1

OvermindDL1

/me coughs

Eiji

Eiji OP

@OvermindDL1: I saw it, but my is little different. I need to write one mix task and add some tests then I release it and you will see my idea. It could be great if you can review my code especially my work on macros, because it’s first time I’m working on them so much.

Eiji

Eiji OP

@OvermindDL1: I’m writing tests for it now.
You said that working on *.beam files is not good way in some situations (edge-cases).
I’m using: &Code.load_file/2 to load .ex file from test/fixtures/ project directory. This file contains only import call (for calling macro to define api) + of course call that macro - nothing more.
Then I’m using my register method passing only module name. This calls only one auto-generated API function and only work on data that this method returns - no beam or other files are used here.
Is it what you want when you said about dynamically load files or should I test it in another way?

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews