|
| 1 | +# 0800 |
| 2 | + |
| 3 | +Read through all code, familiarise myself with the task. |
| 4 | +Summary: |
| 5 | +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. |
| 6 | + |
| 7 | +Strategy: |
| 8 | +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. |
| 9 | +2. Capture request and response JSON and use it to generate structs and for serde tests. |
| 10 | +3. Write `reqwest`-level modules for calling the endpoint. |
| 11 | +4. Integrate this module with a service. |
| 12 | + |
| 13 | +(Copied from the readme) |
| 14 | + |
| 15 | +My usual first step with a port is to have an example of the old client functional so I can compare implementations. |
| 16 | + |
| 17 | +To begin with, I will take point one and explore Perspective with Bruno. |
| 18 | + |
| 19 | +# 0841 |
| 20 | + |
| 21 | +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). |
| 22 | +It requires a Google Cloud account and a verification process to use properly, which takes up to one business day. This |
| 23 | +could be step 4. |
| 24 | + |
| 25 | +# 0941 |
| 26 | + |
| 27 | +The "old client" just calls the actual JS API client and adds an API key etc to make the internal interface more pleasant. |
| 28 | +Is the challenge therefore to rewrite the typescript wrapper for this API in Rust, leveraging the FFI to call that |
| 29 | +JS package through WASM, or is it to rewrite that JS client itself? |
| 30 | + |
| 31 | +# 1038 |
| 32 | + |
| 33 | +My first coding task will be to model the typescript functionality in Rust, without considering IO for now. |
| 34 | +Bruno is a great tool, but I am struggling to get the response back. Testing with cURL works, but what looks |
| 35 | +like the same configuration does not work in Bruno. I will revisit this after some modelling. |
| 36 | + |
| 37 | +I have fleshed out the project with some copy/pasting from the other two projects. I have modelled the structure |
| 38 | +on the TikTok project, and I am working through the typescript project in parallel to form a first case. |
| 39 | + |
| 40 | +# 1200 |
| 41 | + |
| 42 | +Lunch |
| 43 | + |
| 44 | +# 1300 |
| 45 | + |
| 46 | +Got Bruno to work. Silly auth config issue. Now I can flesh out some examples and decide on the API contract. |
| 47 | + |
| 48 | +TODO |
| 49 | + |
| 50 | +Build a generic Rust library of one function called analyze which mimics the functionality of the original JS API. |
| 51 | + Flesh out a collection of Bruno examples demonstrating the use of the single end point. |
| 52 | + Write tests which call the endpoint and demonstrate its use. |
| 53 | + Write a Stub implementation. |
| 54 | + |
| 55 | +Build a specific Arwen library of one or more functions which mimics the old typescript implementation and uses the generic library. |
| 56 | +Build a service using the Arwen library using Axum |
| 57 | + |
| 58 | + |
| 59 | +# 1430 |
| 60 | + |
| 61 | +Almost got a reqwest client to work with the sample data I used in Bruno. |
| 62 | + |
| 63 | +# 1500 |
| 64 | + |
| 65 | +Conversation with James to focus the scope of the work. In the same crate, I am to build a mirror of the Perspective API |
| 66 | +in one module, and a service for Arwen using that API in another. |
0 commit comments