# 0800
Read through all code, familiarise myself with the task.
Summary:
There is an integration with the Perspective API built in Typescript which still needs migrating to Rust. There is a sample implementation for the TikTok API for reference, so I can copy the style. The MVP is to port one endpoint from Typescript into Rust in a new client.
Strategy:
1. I start low-level by creating some requests in [Bruno](https://www.usebruno.com/). I can't implement a client without exploring the API outside the clutter of a programming language.
2. Capture request and response JSON and use it to generate structs and for serde tests.
3. Write `reqwest`-level modules for calling the endpoint.
4. Integrate this module with a service.
(Copied from the readme)
My usual first step with a port is to have an example of the old client functional so I can compare implementations.
To begin with, I will take point one and explore Perspective with Bruno.
# 0841
The perspective API already has Python and Node.js implementations provided by Google. There is also a [sample Typescript implementation](https://github.com/conversationai/perspectiveapi-simple-server/tree/main).
It requires a Google Cloud account and a verification process to use properly, which takes up to one business day. This
could be step 4.
# 0941
The "old client" just calls the actual JS API client and adds an API key etc to make the internal interface more pleasant.
Is the challenge therefore to rewrite the typescript wrapper for this API in Rust, leveraging the FFI to call that
JS package through WASM, or is it to rewrite that JS client itself?
# 1038
My first coding task will be to model the typescript functionality in Rust, without considering IO for now.
Bruno is a great tool, but I am struggling to get the response back. Testing with cURL works, but what looks
like the same configuration does not work in Bruno. I will revisit this after some modelling.
I have fleshed out the project with some copy/pasting from the other two projects. I have modelled the structure
on the TikTok project, and I am working through the typescript project in parallel to form a first case.
# 1200
Lunch
# 1300
Got Bruno to work. Silly auth config issue. Now I can flesh out some examples and decide on the API contract.
TODO
Build a generic Rust library of one function called analyze which mimics the functionality of the original JS API.
Flesh out a collection of Bruno examples demonstrating the use of the single end point.
Write tests which call the endpoint and demonstrate its use.
Write a Stub implementation.
Build a specific Arwen library of one or more functions which mimics the old typescript implementation and uses the generic library.
Build a service using the Arwen library using Axum
# 1430
Almost got a reqwest client to work with the sample data I used in Bruno.
# 1500
Conversation with James to focus the scope of the work. In the same crate, I am to build a mirror of the Perspective API
in one module, and a service for Arwen using that API in another.