From a0c6727a617350895fddd1487870f83a3700d6a2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 16:48:34 +0200 Subject: [PATCH] i18n - docs translations (#19212) Created by Github action Co-authored-by: github-actions --- .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ .../generate-pdf-from-twenty.mdx | 83 +++++++++++++------ 8 files changed, 472 insertions(+), 192 deletions(-) diff --git a/packages/twenty-docs/l/ar/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/ar/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index b333e46f94..a3f6d066ee 100644 --- a/packages/twenty-docs/l/ar/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/ar/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### لإرفاقه بكائن مختلف -استبدل `companyId` بالحقل المناسب: +استبدل `targetCompanyId` بالحقل المناسب: -| كائن | اسم الحقل | -| ---------- | -------------------- | -| الشركة | `companyId` | -| شخص | `personId` | -| الفرصة | `opportunityId` | -| كائن مخصّص | `yourCustomObjectId` | +| كائن | اسم الحقل | +| ---------- | -------------------------- | +| الشركة | `targetCompanyId` | +| شخص | `targetPersonId` | +| الفرصة | `targetOpportunityId` | +| كائن مخصّص | `targetYourCustomObjectId` | حدّث كل من معلمة الوظيفة وكائن `variables.data` في عملية الـ mutation الخاصة بالمرفق. diff --git a/packages/twenty-docs/l/cs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/cs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index 0c9f5cbaee..a47a68b70a 100644 --- a/packages/twenty-docs/l/cs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/cs/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### Chcete-li připojit k jinému objektu -Nahraďte `companyId` příslušným polem: +Nahraďte `targetCompanyId` příslušným polem: -| Objekt | Název pole | -| -------------- | -------------------- | -| Společnost | `companyId` | -| Osoba | `personId` | -| Příležitost | `opportunityId` | -| Vlastní objekt | `yourCustomObjectId` | +| Objekt | Název pole | +| -------------- | -------------------------- | +| Společnost | `targetCompanyId` | +| Osoba | `targetPersonId` | +| Příležitost | `targetOpportunityId` | +| Vlastní objekt | `targetYourCustomObjectId` | Aktualizujte jak parametr funkce, tak objekt `variables.data` v mutaci přílohy. diff --git a/packages/twenty-docs/l/de/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/de/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index d206475c48..0d48405ce7 100644 --- a/packages/twenty-docs/l/de/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/de/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### An ein anderes Objekt anhängen -Ersetzen Sie `companyId` durch das entsprechende Feld: +Ersetzen Sie `targetCompanyId` durch das entsprechende Feld: -| Objekt | Feldname | -| -------------------------- | -------------------- | -| Unternehmen | `companyId` | -| Person | `personId` | -| Opportunity | `opportunityId` | -| Benutzerdefiniertes Objekt | `yourCustomObjectId` | +| Objekt | Feldname | +| -------------------------- | -------------------------- | +| Unternehmen | `targetCompanyId` | +| Person | `targetPersonId` | +| Opportunity | `targetOpportunityId` | +| Benutzerdefiniertes Objekt | `targetYourCustomObjectId` | Aktualisieren Sie sowohl den Funktionsparameter als auch das Objekt `variables.data` in der Attachment-Mutation. diff --git a/packages/twenty-docs/l/it/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/it/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index 81e5a83588..fa36cbf979 100644 --- a/packages/twenty-docs/l/it/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/it/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### Per allegare a un oggetto diverso -Sostituisci `companyId` con il campo appropriato: +Sostituisci `targetCompanyId` con il campo appropriato: -| Oggetto | Nome del campo | -| ---------------------- | -------------------- | -| Azienda | `companyId` | -| Persona | `personId` | -| Opportunità | `opportunityId` | -| Oggetto personalizzato | `yourCustomObjectId` | +| Oggetto | Nome del campo | +| ---------------------- | -------------------------- | +| Azienda | `targetCompanyId` | +| Persona | `targetPersonId` | +| Opportunità | `targetOpportunityId` | +| Oggetto personalizzato | `targetYourCustomObjectId` | Aggiorna sia il parametro della funzione sia l'oggetto `variables.data` nella mutation dell'allegato. diff --git a/packages/twenty-docs/l/ro/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/ro/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index 1a4bfa6ed6..603f392fa3 100644 --- a/packages/twenty-docs/l/ro/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/ro/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### Pentru a atașa la un alt obiect -Înlocuiți `companyId` cu câmpul corespunzător: +Înlocuiți `targetCompanyId` cu câmpul corespunzător: -| Obiect | Nume câmp | -| ------------------- | -------------------- | -| Companie | `companyId` | -| Persoană | `personId` | -| Oportunitate | `opportunityId` | -| Obiect personalizat | `yourCustomObjectId` | +| Obiect | Nume câmp | +| ------------------- | -------------------------- | +| Companie | `targetCompanyId` | +| Persoană | `targetPersonId` | +| Oportunitate | `targetOpportunityId` | +| Obiect personalizat | `targetYourCustomObjectId` | Actualizați atât parametrul funcției, cât și obiectul `variables.data` în mutația de atașare. diff --git a/packages/twenty-docs/l/ru/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/ru/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index fba91bc01a..49f9235156 100644 --- a/packages/twenty-docs/l/ru/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/ru/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### Чтобы прикреплять к другому объекту -Замените `companyId` на соответствующее поле: +Замените `targetCompanyId` на соответствующее поле: -| Объект | Имя поля | -| ----------------------- | -------------------- | -| Компания | `companyId` | -| Контакт | `personId` | -| Сделка | `opportunityId` | -| Пользовательский объект | `yourCustomObjectId` | +| Объект | Имя поля | +| ----------------------- | -------------------------- | +| Компания | `targetCompanyId` | +| Контакт | `targetPersonId` | +| Сделка | `targetOpportunityId` | +| Пользовательский объект | `targetYourCustomObjectId` | Обновите и параметр функции, и объект `variables.data` в мутации вложения. diff --git a/packages/twenty-docs/l/tr/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/tr/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index 7255d70003..e86a618f6d 100644 --- a/packages/twenty-docs/l/tr/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/tr/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### Farklı bir nesneye eklemek için -`companyId` değerini uygun alanla değiştirin: +Replace `targetCompanyId` with the appropriate field: -| Nesne | Alan Adı | -| ---------- | -------------------- | -| Şirket | `companyId` | -| Kişi | `personId` | -| Fırsat | `opportunityId` | -| Özel Nesne | `yourCustomObjectId` | +| Nesne | Alan Adı | +| ---------- | -------------------------- | +| Şirket | `targetCompanyId` | +| Kişi | `targetPersonId` | +| Fırsat | `targetOpportunityId` | +| Özel Nesne | `targetYourCustomObjectId` | Ek oluşturma mutasyonunda hem işlev parametresini hem de `variables.data` nesnesini güncelleyin. diff --git a/packages/twenty-docs/l/zh/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx b/packages/twenty-docs/l/zh/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx index f09dee2f8b..1a0136185f 100644 --- a/packages/twenty-docs/l/zh/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx +++ b/packages/twenty-docs/l/zh/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty.mdx @@ -55,11 +55,12 @@ export const main = async ( params: { companyId: string }, ) => { const { companyId } = params; - - // Replace with your Twenty GraphQL endpoint + // Replace with your Twenty GraphQL endpoints (/metadata for metadata and files or /graphql for your records) // Cloud: https://api.twenty.com/graphql // Self-hosted: https://your-domain.com/graphql - const graphqlEndpoint = 'https://api.twenty.com/graphql'; + + const metadataGraphqlEndpoint = 'https://api.twenty.com/metadata'; + const dataGraphqlEndpoint = 'https://api.twenty.com/graphql'; // Replace with your API key from Settings → APIs const authToken = 'YOUR_API_KEY'; @@ -79,11 +80,40 @@ export const main = async ( const pdfBlob = await pdfResponse.blob(); const pdfFile = new File([pdfBlob], filename, { type: 'application/pdf' }); - // Step 2: Upload the file via GraphQL multipart upload + const fieldMetadataIdQuery = ` + query FindUploadFileFieldMetadataId { + objects { + edges { + node { + nameSingular + fieldsList { + id + name + } + } + } + } + } + `; + + // Step 2: Find a fieldMetadataId of "Attachment file" field in Attachments object with GraphQL API + const response = await fetch(metadataGraphqlEndpoint, { + method: 'POST', + headers: { + Authorization: `Bearer ${authToken}` + }, + body: { + query: fieldMetadataIdQuery, + } + }); + const result = await response.json(); + const uploadFileFieldMetadataId = result.data.objects.edges.find(object => object.node.nameSingular === 'attachment').node.fieldsList.find(field => field.name === 'file').id; + + // Step 3: Upload the file via GraphQL multipart upload const uploadMutation = ` - mutation UploadFile($file: Upload!, $fileFolder: FileFolder) { - uploadFile(file: $file, fileFolder: $fileFolder) { - path + mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) { + uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) { + id } } `; @@ -91,12 +121,12 @@ export const main = async ( const uploadForm = new FormData(); uploadForm.append('operations', JSON.stringify({ query: uploadMutation, - variables: { file: null, fileFolder: 'Attachment' }, + variables: { file: null, fieldMetadataId: uploadFileFieldMetadataId }, })); uploadForm.append('map', JSON.stringify({ '0': ['variables.file'] })); uploadForm.append('0', pdfFile); - const uploadResponse = await fetch(graphqlEndpoint, { + const uploadResponse = await fetch(metadataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}` }, body: uploadForm, @@ -108,15 +138,15 @@ export const main = async ( throw new Error(`Upload failed: ${uploadResult.errors[0].message}`); } - const filePath = uploadResult.data?.uploadFile?.path; + const fileId = uploadResult.data?.uploadFilesFieldFile?.id; - if (!filePath) { - throw new Error('No file path returned from upload'); + if (!fileId) { + throw new Error('No file id returned from upload'); } - // Step 3: Create the attachment linked to the company + // Step 4: Create the attachment linked to the company const attachmentMutation = ` - mutation CreateAttachment($data: AttachmentCreateInput!) { + mutation CreateOneAttachment($data: AttachmentCreateInput!) { createAttachment(data: $data) { id name @@ -124,7 +154,7 @@ export const main = async ( } `; - const attachmentResponse = await fetch(graphqlEndpoint, { + const attachmentResponse = await fetch(dataGraphqlEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${authToken}`, @@ -135,8 +165,13 @@ export const main = async ( variables: { data: { name: filename, - fullPath: filePath, - companyId, + targetCompanyId: companyId, + file: [ + { + fileId: fileId, + label: filename + } + ] }, }, }), @@ -156,14 +191,14 @@ export const main = async ( #### 要附加到其他对象 -将 `companyId` 替换为相应的字段: +将 `targetCompanyId` 替换为相应的字段: -| 对象 | 字段名称 | -| ----- | -------------------- | -| 公司 | `companyId` | -| 人员 | `personId` | -| 机会 | `opportunityId` | -| 自定义对象 | `yourCustomObjectId` | +| 对象 | 字段名称 | +| ----- | -------------------------- | +| 公司 | `targetCompanyId` | +| 人员 | `targetPersonId` | +| 机会 | `targetOpportunityId` | +| 自定义对象 | `targetYourCustomObjectId` | 同时更新函数参数以及附件的 mutation 中的 `variables.data` 对象。