Skip to content

Commit

Permalink
feat(API): Implement figma attachments endpoints (#415)
Browse files Browse the repository at this point in the history
* feat: Implement figma attachments endpoints

* CR
  • Loading branch information
Varpuspaavi authored Oct 13, 2023
1 parent b27c83f commit 970e612
Show file tree
Hide file tree
Showing 12 changed files with 957 additions and 1 deletion.
544 changes: 544 additions & 0 deletions doc/compiled.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ key_id:
required: true
schema:
type: string
figma_attachment_id:
in: path
name: figma_attachment_id
description: Figma attachment ID
required: true
schema:
type: string
job_id:
in: path
name: job_id
Expand Down
19 changes: 18 additions & 1 deletion paths.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

"/icu/skeleton":
post:
"$ref": "./paths/icu/skeleton.yaml"
Expand All @@ -12,6 +11,24 @@
"/projects/{project_id}/documents/{id}":
delete:
"$ref": "./paths/documents/destroy.yaml"
"/projects/{project_id}/figma_attachments":
get:
"$ref": "./paths/figma_attachments/index.yaml"
post:
"$ref": "./paths/figma_attachments/create.yaml"
"/projects/{project_id}/figma_attachments/{id}":
get:
"$ref": "./paths/figma_attachments/show.yaml"
patch:
"$ref": "./paths/figma_attachments/update.yaml"
delete:
"$ref": "./paths/figma_attachments/destroy.yaml"
"/projects/{project_id}/figma_attachments/{figma_attachment_id}/keys":
post:
"$ref": "./paths/figma_attachment_keys/create.yaml"
"/projects/{project_id}/figma_attachments/{figma_attachment_id}/keys/{id}":
delete:
"$ref": "./paths/figma_attachment_keys/destroy.yaml"
"/projects/{project_id}/styleguides":
get:
"$ref": "./paths/styleguides/index.yaml"
Expand Down
44 changes: 44 additions & 0 deletions paths/figma_attachment_keys/create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
summary: Attach the Figma attachment to a key
description: Attach the Figma attachment to a key
operationId: figma_attachment/attach_to_key
tags:
- Key's Figma attachments
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- "$ref": "../../parameters.yaml#/figma_attachment_id"
- "$ref": "../../parameters.yaml#/id"
- description: specify the branch to use
example: my-feature-branch
name: branch
in: query
schema:
type: string
responses:
"204":
"$ref": "../../responses.yaml#/204"
"400":
"$ref": "../../responses.yaml#/400"
"404":
"$ref": "../../responses.yaml#/404"
"429":
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/figma_attachments/:figma_attachment_id/keys" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-F branch=my-feature-branch \
-F id=key_id \
-H 'Content-Type: application/json'
- lang: CLI v2
source: |-
phrase figma_attachment attach_to_key \
--project_id <project_id> \
--figma_attachment_id <figma_attachment_id> \
--id <id> \
--branch my-feature-branch \
--access_token <token>
x-cli-version: "2.13"
43 changes: 43 additions & 0 deletions paths/figma_attachment_keys/destroy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
summary: Detach the Figma attachment from a key
description: Detach the Figma attachment from a key
operationId: figma_attachment/detach_from_key
tags:
- Key's Figma attachments
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- "$ref": "../../parameters.yaml#/figma_attachment_id"
- "$ref": "../../parameters.yaml#/id"
- description: specify the branch to use
example: my-feature-branch
name: branch
in: query
schema:
type: string
responses:
"204":
"$ref": "../../responses.yaml#/204"
"400":
"$ref": "../../responses.yaml#/400"
"404":
"$ref": "../../responses.yaml#/404"
"429":
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/figma_attachments/:figma_attachment_id/keys/:id" \
-u USERNAME_OR_ACCESS_TOKEN \
-X DELETE \
-F branch=my-feature-branch \
-H 'Content-Type: application/json'
- lang: CLI v2
source: |-
phrase figma_attachment detach_from_key \
--project_id <project_id> \
--figma_attachment_id <figma_attachment_id> \
--id <id> \
--branch my-feature-branch \
--access_token <token>
x-cli-version: "2.13"
66 changes: 66 additions & 0 deletions paths/figma_attachments/create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
summary: Create a Figma attachment
description: Create a new Figma attachment.
operationId: figma_attachment/create
tags:
- Figma attachments
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- description: specify the branch to use
example: my-feature-branch
name: branch
in: query
schema:
type: string
responses:
"201":
description: Created
content:
application/json:
schema:
"$ref": "../../schemas/figma_attachment.yaml#/figma_attachment"
headers:
X-Rate-Limit-Limit:
"$ref": "../../headers.yaml#/X-Rate-Limit-Limit"
X-Rate-Limit-Remaining:
"$ref": "../../headers.yaml#/X-Rate-Limit-Remaining"
X-Rate-Limit-Reset:
"$ref": "../../headers.yaml#/X-Rate-Limit-Reset"
"400":
"$ref": "../../responses.yaml#/400"
"404":
"$ref": "../../responses.yaml#/404"
"429":
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/figma_attachments" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-F branch=my-feature-branch \
-F url=https://figma.com/file/xxxxx/sample \
- lang: CLI v2
source: |-
phrase figma_attachment create \
--project_id <project_id> \
--data '{"branch":"my-feature-branch", "url":"https://figma.com/file/xxxxx/sample"}' \
--access_token <token>
requestBody:
required: true
content:
application/json:
schema:
type: object
title: figma_attachment/create/parameters
properties:
branch:
description: specify the branch to use
type: string
example: my-feature-branch
url:
description: Figma file url
type: string
example: https://figma.com/file/xxxxx/sample
x-cli-version: "2.13"
41 changes: 41 additions & 0 deletions paths/figma_attachments/destroy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
summary: Delete a Figma attachment
description: Delete an existing Figma attachment.
operationId: figma_attachment/delete
tags:
- Figma attachments
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- "$ref": "../../parameters.yaml#/id"
- description: specify the branch to use
example: my-feature-branch
name: branch
in: query
schema:
type: string
responses:
"204":
"$ref": "../../responses.yaml#/204"
"400":
"$ref": "../../responses.yaml#/400"
"404":
"$ref": "../../responses.yaml#/404"
"429":
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/figma_attachments/:id" \
-u USERNAME_OR_ACCESS_TOKEN \
-X DELETE \
-d '{"branch":"my-feature-branch"}' \
-H 'Content-Type: application/json'
- lang: CLI v2
source: |-
phrase figma_attachment delete \
--project_id <project_id> \
--id <id> \
--branch my-feature-branch \
--access_token <token>
x-cli-version: "2.13"
54 changes: 54 additions & 0 deletions paths/figma_attachments/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
summary: List Figma attachments
description: List all Figma attachments for the given project
operationId: figma_attachments/list
tags:
- Figma attachments
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- "$ref": "../../parameters.yaml#/page"
- "$ref": "../../parameters.yaml#/per_page"
- description: specify the branch to use
example: my-feature-branch
name: branch
in: query
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
"$ref": "../../schemas/figma_attachment.yaml#/figma_attachment"
headers:
X-Rate-Limit-Limit:
"$ref": "../../headers.yaml#/X-Rate-Limit-Limit"
X-Rate-Limit-Remaining:
"$ref": "../../headers.yaml#/X-Rate-Limit-Remaining"
X-Rate-Limit-Reset:
"$ref": "../../headers.yaml#/X-Rate-Limit-Reset"
Link:
"$ref": "../../headers.yaml#/Link"
"400":
"$ref": "../../responses.yaml#/400"
"404":
"$ref": "../../responses.yaml#/404"
"429":
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/figma_attachments?branch=my-feature-branch" \
-X GET \
-u USERNAME_OR_ACCESS_TOKEN
- lang: CLI v2
source: |-
phrase figma_attachments list \
--project_id <project_id> \
--branch my-feature-branch \
--access_token <token>
x-cli-version: "2.13"
50 changes: 50 additions & 0 deletions paths/figma_attachments/show.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
summary: Get a single Figma attachment
description: Get details on a single Figma attachment for a given project.
operationId: figma_attachment/show
tags:
- Figma attachments
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- "$ref": "../../parameters.yaml#/id"
- description: specify the branch to use
example: my-feature-branch
name: branch
in: query
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
"$ref": "../../schemas/figma_attachment.yaml#/figma_attachment"
headers:
X-Rate-Limit-Limit:
"$ref": "../../headers.yaml#/X-Rate-Limit-Limit"
X-Rate-Limit-Remaining:
"$ref": "../../headers.yaml#/X-Rate-Limit-Remaining"
X-Rate-Limit-Reset:
"$ref": "../../headers.yaml#/X-Rate-Limit-Reset"
"400":
"$ref": "../../responses.yaml#/400"
"404":
"$ref": "../../responses.yaml#/404"
"429":
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/projects/:project_id/figma_attachments/:id?branch=my-feature-branch" \
-X GET \
-u USERNAME_OR_ACCESS_TOKEN
- lang: CLI v2
source: |-
phrase figma_attachment show \
--project_id <project_id> \
--id <id> \
--branch my-feature-branch \
--access_token <token>
x-cli-version: "2.13"
Loading

0 comments on commit 970e612

Please sign in to comment.