# EzRF x OpenSourceObserver API In EasyRetroFunding we want to enable Round managers to create Rounds with RF4-style Impact voting. - Register Project Application - How can we link the project to an OSO project? - Round Configure Metrics - Query a list of metrics for admin to choose from - List Metrics - To display to a badgeholder for adding to ballot - Metric Details - More detailed information about metric and the project distribution ### List Metrics Round manager wants to list all available metrics so they can configure their round by choosing metrics to include. We also want to be able to query metrics by sending an array of metricIds. This is to display the configured metrics for the voters to vote on. For each metric we want to see the distribution for the projects that has been approved in the Round. ```ts GET /metrics GET /metrics?ids=1,2,3 // Only returns metrics matching the IDs GET /metrics?query=search&skip=3&limit=10&sort=&order=desc // Search, pagination, and sorting GET /metrics?ids=1,2,3&projectIds=1,2,3,4 // Return Metric by ID and Project distribution for this metric ``` #### Schema ```ts type Metric { metricId: string; name: string; description: string; calculationUrl: string; projectAllocations: ProjectAllocation[]; } type ProjectAllocation { projectId: string; // OSO Project ID - we would need to map this to the project ID on our side amount: number; // As percentage - 0.15 for 15% for this metric isOpenSource: boolean; // Name and image we can probably get from our API name: string; image?: string; } ``` ### Get Metric Get a specific Metric by ID. This also returns the ProjectAllocations for the metric seen in the screenshot below in the right sidebar. ```ts // We could probably re-used the same endpoint above but with just 1 Metric ID GET /metrics?ids=3&projectIds=1,2,3,4 // Projects to include in the distribution sidebar ``` ![image](https://hackmd.io/_uploads/ryjghhFBR.png) ### Get Project Badgeholder wants to see what their allocation looks like. For each of the metrics they have added to their ballot, list the projects and each projects metric allocation. Fetch all the approved projects for the metrics configured in the Round. ```ts GET /projects?ids=1,2,3,4&metricIds=1,2,3 // Returns projects matching the IDs ``` ![image](https://hackmd.io/_uploads/rk9j3hYr0.png) #### Schema ```ts type Project { id: string; name: string; image: string; metricAllocations: MetricAllocation[] } type MetricAllocation { metricId: string; amount: number; } ```