Az alkalmazásleíró a Crowdin alkalmazások egyik alapvető alkotóeleme. Az alkalmazásleíró egy JSON fájl (például: crowdin.json
), amely általános információkat tartalmaz az alkalmazásról, valamint azokról a modulokról, amelyekkel az alkalmazás működni vagy bővülni szeretne. Leírja, hogyan fog működni az alkalmazás, milyen erőforrásokat fog használni, stb. Az alábbiakban láthat ehhez egy példát.
{
"identifier": "my-application-identifier",
"name": "My Application",
"description": "Application description",
"logo": "/assets/logos/app-logo.png",
"baseUrl": "http://example.com",
"authentication": {
"type": "authorization_code",
"clientId": "your-client-id"
},
"events": {
"installed": "/hooks/installed"
},
"scopes": [
"project"
],
"modules": {
"integrations": [
{
"key": "my-module-key",
"name": "Module Name",
"description": "Module description",
"logo": "/assets/logos/module-logo.png",
"url": "/page/integration"
}
]
}
}
identifier | Típus: Szükséges: igen Leírás: Egy egyedi kulcs az alkalmazás azonosításához. Az azonosító megengedett hossza <= 255 characters. |
name | Típus: Szükséges: igen Leírás: Az ember által olvasható alkalmazásnév. |
baseUrl | Típus: Szükséges: igen Description: The base URL of the remote app, which is used for all communications back to the app instance. Ez fontos: bölcsen válassza ki a baseUrl-t, mielőtt alkalmazását nyilvánosságra hozná. Megjegyzés: Minden alkalmazásnak rendelkeznie kell egy egyedi baseUrl-lel. Ha több alkalmazást szeretne kiszolgálni ugyanarról a hosztról, |
authentication | Típus: Szükséges: igen Leírás: Megadja a hitelesítési típust, amelyet a gazdaalkalmazás és a Crowdin alkalmazás közötti kérelmek aláírásakor használ. |
description | Típus: Description: The human-readable description of what the app does. |
logo | Típus: Description: The image URL relative to the app's base URL which will be displayed in the Crowdin UI. |
events | Típus: Description: Allow the app to register for app event notifications. |
scopes | Típus: [ Description: Set of scopes requested by this app.
|
modules | Típus: Description: The list of modules this app provides. |
Specifies the authentication type to use when signing requests from the host application to the Crowdin app. Crowdin Apps support two types of authentication:
authorization_code
value)none
value)In case your Crowdin app requires access to Crowdin API at any time, it’s recommended to use the authorization_code
, in other cases feel free to use the none
. The authentication type none
grants access to Crowdin API as well as the authorization_code
, but only when the Crowdin app is executed on the user side, for example, when the iframe opens.
Minta:
{
"authentication": {
"type": "authorization_code",
"clientId": "your-client-id"
}
}
Tulajdonságok:
type | Típus: Alapértelmezett: Allowed values: Leírás: A használni kívánt hitelesítés típusa. |
clientId | Típus: Leírás: OAuth ügyfélazonosító a hitelesítéshez az |
Modules are how apps extend Crowdin and interact with it. Using modules your app can do the following things:
Read more about Modules.
Allow an app to register callbacks for events that occur in the workspace. When an event is fired, a POST request will be made to the appropriate URL registered for the event. The installed callback is an integral part of the installation process of an app, whereas the remaining events are essentially webhooks. Each property within this object is a URL relative to the app’s base URL.
Minta:
{
"events": {
"installed": "/hook/installed",
"uninstall": "/hook/uninstall"
}
}
Tulajdonságok:
installed | Típus: Leírás: Az az esemény, amelyet egy alkalmazásnak küldünk, miután a felhasználó telepítette az alkalmazást a Crowdinban. This event is required if you use |
uninstall | Típus: Description: The event that is sent to an app before the app uninstallation from Crowdin. |
Telepítve esemény
A telepítve eseményt a Crowdin elküldi a távoli Crowdin alkalmazásnak, amikor a felhasználó telepíti az alkalmazást a Crowdin alkalmazásba. The Installed event contains the information about the Crowdin workspace the Crowdin App was installed to, the information about the app itself, as well as the app authorization_code. As soon as the authorization_code is received it’s necessary to authorize the app using the access and refresh tokens.
Read more about Installed Event Flow.
Payload example:
{
"appId": "my-application-identifier",
"clientId": "your-client-id",
"userId": 1,
"organizationId": 1,
"domain": null,
"baseUrl": "https://crowdin.com",
"code": "def.....608bdad9c625bd2eedf1fd6"
}
Tulajdonságok:
appId | Típus: Leírás: Az alkalmazás azonosítója, amely deklarálva van az alkalmazás leíró fájljában. |
clientId | Típus: Leírás: Az alkalmazásleíró fájlban deklarált OAuth ügyfélazonosító. |
userId | Típus: Leírás: Azon felhasználó numerikus azonosítója, aki az alkalmazást a Crowdinban telepítette. |
organizationId | Típus: Leírás: A szervezet numerikus azonosítója, amelybe az alkalmazást telepítették. |
domain | Típus: Leírás: A szervezet neve, amelybe az alkalmazást telepítették. Crowdin esetén a tartomány értéke mindig |
baseUrl | Típus: Leírás: A szervezet baseUrl-e, amelybe az alkalmazást telepítették. A Crowdin esetén a baseUrl érték mindig |
code | Típus: Leírás: A Crowdin alkalmazás engedélyezéséhez használt kód. |
Eltávolítási esemény
Az eltávolítási eseményt a Crowdin elküldi a távoli Crowdin alkalmazásnak, amikor a felhasználó eltávolítja az alkalmazást a Crowdin alkalmazásból. Az Eltávolítási esemény, akárcsak a telepítési esemény, tartalmazza a Crowdin munkaterületre vonatkozó információkat, ahová a Crowdin App telepítve lett, és magának az alkalmazásnak az információit. Az eltávolítási esemény fogadása után meg kell keresni és eltávolítani a Crowdin munkaterülethez kapcsolódó összes adatot, amelyből az alkalmazás eltávolításra kerül.
Payload example:
{
"appId": "my-application-identifier",
"clientId": "your-client-id",
"organizationId": 1,
"domain": null,
"baseUrl": "https://crowdin.com"
}
Tulajdonságok:
appId | Típus: Leírás: Az alkalmazás azonosítója, amely deklarálva van az alkalmazás leíró fájljában. |
clientId | Típus: Leírás: Az alkalmazásleíró fájlban deklarált OAuth ügyfélazonosító. |
organizationId | Típus: Leírás: A szervezet numerikus azonosítója, amelyből az alkalmazás eltávolításra kerül. |
domain | Típus: Leírás: A szervezet neve, amelyből az alkalmazás eltávolításra kerül. Crowdin esetén a tartomány értéke mindig |
baseUrl | Típus: Leírás: A szervezet baseUrl-e, amelyből az alkalmazás eltávolításra kerül. A Crowdin esetén a baseUrl érték mindig |