Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(API): Implement figma attachments endpoints #415

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_key/create
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be more logical to add these operations to figma_attachments (or perhaps keys) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted, not exactly sure if this is what you meant
CR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, but they'd also have to live on paths/figma_attachments IMO

Copy link
Collaborator

@jablan jablan Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I guess the API PR has already been merged in phrase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the API PR is merged. Can we have two create.yaml/destroy.yaml in the same folder? I could adjust this. On the API PR we agreed to not use custom named methods and instead went with second controller to have option for second create/destroy paths

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_key create \
--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_key/delete
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_key delete \
--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
Loading