You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+1-29
Original file line number
Diff line number
Diff line change
@@ -45,32 +45,4 @@ yarn build
45
45
46
46
## Contributing an API Integration
47
47
48
-
**1:** Ensure that the project is configured in the local environment following the instructions outlined [here](https://github.com/revertinc/revert/blob/main/CONTRIBUTING.md). Establish a connection to an existing application and test various [endpoints](https://docs.revert.dev/api-reference) to verify proper functionality.
49
-
50
-
**2:** Analyze the authentication and authorization flow based on the requirements of the third-party API. Identify the appropriate authentication type, which may include options such as Basic, OAuth 2.0, OAuth 1.0, API Key, etc depending on the thirdparty.
51
-
52
-
**3:** Incorporate your third-party integration by adding it to the Prisma TP_ID enum. Execute the command `yarn migration:dev` in `packages/backend` to apply the necessary database migrations.
53
-
54
-
**4:** Implement the recommended authentication and refresh token flows for the third-party integration. To generate access tokens and establish a connection, refer to the relevant code in `packages/backend/routes/v1/` within respective sub-packages like `crm, chat, ticketing, etc`. For the refresh token flow, inspect the methods available in `packages/backend/services/auth.ts`, for categorized token-refreshing methods such as `refreshOAuthTokensForThirdParty` and `refreshOAuthTokensForThirdPartyTicketServices`.
55
-
56
-
> Note: If you are introducing a new category that lacks a corresponding structure in the project, feel free to create new packages as needed. Should you require assistance, please don't hesitate to reach out to us on [Discord](<(https://discord.gg/q5K5cRhymW)>).
57
-
58
-
**5:** Incorporate the designated value as a string (previously setin the `TP_ID` enum in the Prisma schema) within the suitable category in both `packages/backend/common.ts` and `packages/backend/prisma/seed.ts`.
59
-
60
-
**6:** Prior to Unification, when implementing any given endpoint, initiate the process by generating a fern configuration for it. Ensure that thirdparty endpoint/operations for the specified API are conducted through Revert.
61
-
62
-
**7:** For the given endpoint(s), unify the schema and fields by implementing them in`packages/backend/prisma/fields.ts`.
63
-
64
-
**Unification Process:** Performed while retrieving resources from third party to match the provided schema. The process involves the following steps:
65
-
66
-
1. Request to Third-Party Endpoint: Begin by initiating a request to the third-party endpoint.
67
-
2. unifyObject: After receiving the response, pass it to `unifyObject`, incorporating a preprocessing to standardize essential values.
68
-
3. transformFieldMappingToModel: Send the preprocessed data to `transformFieldMappingToModel`, which aligns it with the provided schema.
69
-
4. Unified Response: The processed data is returned as a unified response.
70
-
71
-
**Disunification Process:** Primarily performed during the creation or updating of a resource. When a create or update request is made, it is initially in the format defined by Revert. This format is then disunified to align with the structure accepted by the third party. The process involves the following steps:
72
-
73
-
1. `disunifyObject`: The initial Revert-defined format is disunified.
74
-
2. `flattenObj`: Extract additional values from the object.
75
-
3. `transformModelToFieldMapping`: Convert fields to match the format accepted by the third party, which is the reverse of the `transformFieldMappingToModel` step in the unification process.
76
-
4. `postprocessDisUnifyObject`: Modify values to align with the expectations of the third party.
48
+
See https://docs.revert.dev/overview/developer-guide/contribute-an-api-integration for more on how to contribute an integration.
0 commit comments