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: Add data.info(FileDescriptor) #277

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
119 changes: 73 additions & 46 deletions docs/abstract-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,52 @@ abstract.commits.info({

## Data

### The LayerDataset object
## Data

### Retrieve data for file

![API][api-icon]

`data.info(FileDescriptor, RequestOptions): Promise<FileDataset>`

Load layer styles and text styles for a file

```js
abstract.data.info({
projectId: "a36daa90-1736-11e8-b8b0-8d1fec7aef70",
fileId: "616daa90-1736-11e8-b8b0-8d1fec7aef78",
branchId: "master",
sha: "fb7e9b50da6c330fc43ffb369616f0cd1fa92cc2"
});
```

### FileDataset

| Property | Type | Description |
|--------------|-------------|---------------------------------------------------------------------|
| `projectId` | `string` | UUID of the project that this file is contained within |
| `branchId` | `string` | UUID of the branch that this file is contained within |
| `fileId` | `string` | UUID of the file |
| `textStyles` | `LayerTextStyle[]` | [LayerTextStyle](https://sdk.goabstract.com/docs/abstract-api/#layertextstyle)|
| `layerStyles`| `LayerDataProperties[]` | [LayerDataProperties](https://sdk.goabstract.com/docs/abstract-api/#layerdataproperties)|

### Retrieve data for layer

![CLI][cli-icon] ![API][api-icon]

`data.info(LayerVersionDescriptor, RequestOptions): Promise<LayerDataset>`

```js
abstract.data.info({
projectId: "616daa90-1736-11e8-b8b0-8d1fec7aef78",
branchId: "master",
fileId: "51DE7CD1-ECDC-473C-B30E-62AE913743B7",
layerId: "CA420E64-08D0-4B96-B0F7-75AA316B6A19",
sha: "c4e5578c590f5334349b6d7f0dfd4d3882361f1a" // or sha: "latest"
});
```

#### LayerDataset

| Property | Type | Description |
|-------------|-------------|---------------------------------------------------------------------|
Expand All @@ -770,7 +815,7 @@ abstract.commits.info({
| `sha` | `string` | SHA of the commit where the layer was last changed |


### LayerData
#### LayerData

| Property | Type | Description |
|---------------|-------------------|-------------------------------------------------|
Expand All @@ -785,7 +830,7 @@ abstract.commits.info({



### LayerDataProperties
#### LayerDataProperties

| Property | Type | Description |
|--------------------------|------------------------------|---------------------------------------------------------------------------|
Expand Down Expand Up @@ -818,7 +863,7 @@ abstract.commits.info({
| `assets?` | `LayerDataAsset[]` | A list of assets in a layer. Refer to [LayerDataAsset](#layerdataasset) |


### LayerTextStyle
#### LayerTextStyle

| Property | Type | Description |
|---------------------------|-----------------------------|-------------------------------------------------|
Expand All @@ -836,28 +881,28 @@ abstract.commits.info({
| `textTransform?` | `LayerTextTransform` | `0` for none, `1` is for uppercase and `2` is for lowercase |
| `textDecoration?` | `LayerTextDecoration` | Refer to [LayerTextDecoration](#layertextdecoration) |

### LayerTextDecoration
#### LayerTextDecoration

| Property | Type | Description |
|---------------|----------------------------------|--------------------------------------------------------------------------------|
| `line` | `LayerTextDecorationLine` | Refer to [LayerTextDecorationLine](#layertextdecorationline) |
| `style` | `LayerTextDecorationStyle` | Refer to [LayerTextDecorationStyle](#layertextdecorationstyle) |

### LayerTextDecorationLine
#### LayerTextDecorationLine

| Value |
|-------------------|
| `underline` |
| `strikethrough` |

### LayerTextDecorationStyle
#### LayerTextDecorationStyle

| Value |
|-------------------|
| `solid` |
| `double` |

### LayerColor
#### LayerColor

| Property | Type | Description |
|---------------------|-------------------|-------------------------------------------------|
Expand All @@ -868,7 +913,7 @@ abstract.commits.info({
| `components.blue` | `number` | Value of blue (`0` to `1`) |
| `components.alpha` | `number` | Alpha of color (`0` to `1`) |

### LayerBlendMode
#### LayerBlendMode

Can be one of these blend modes:

Expand All @@ -891,7 +936,7 @@ Can be one of these blend modes:
| `LayerBlendModeColor` | `14` | Color |
| `LayerBlendModeLuminosity` | `15` | Luminosity |

### LayerBorderRadius
#### LayerBorderRadius

| Property | Type |
|---------------|-------------------|
Expand All @@ -900,7 +945,7 @@ Can be one of these blend modes:
| `bottomRight` | `number` |
| `bottomLeft` | `number` |

### LayerFill
#### LayerFill

Can be either of these fill types:

Expand All @@ -909,7 +954,7 @@ Can be either of these fill types:
- [LayerFillPattern](#layerfillpattern)
- [LayerFillNoise](#layerfillnoise)

### LayerFillSolid
#### LayerFillSolid

| Property | Value | Description |
|---------------|-------------------|-------------------------------------------------|
Expand All @@ -918,7 +963,7 @@ Can be either of these fill types:
| `opacity` | `number` | `0` to `100` opacity level |
| `color` | `LayerColor` | Refer to [LayerColor](#layercolor) |

### LayerFillGradient
#### LayerFillGradient

| Property | Value | Description |
|---------------|---------------------------|-------------------------------------------------|
Expand All @@ -927,7 +972,7 @@ Can be either of these fill types:
| `opacity` | `number` | `0` to `100` opacity level of filling gradient |
| `gradient` | `LayerGradient` | Refer to [LayerGradient](#layergradient) |

### LayerFillPattern
#### LayerFillPattern

| Property | Value | Description |
|-----------------------|-------------------|---------------------------------------------------------|
Expand All @@ -941,7 +986,7 @@ Can be either of these fill types:
| `imageUrl` | `string` | Image url of a fill |
| `imageId` | `string` | Image id of a fill |

### LayerFillPatternType
#### LayerFillPatternType

| Value | Description |
|-------|------------------------|
Expand All @@ -950,7 +995,7 @@ Can be either of these fill types:
| `2` | Stretch |
| `3` | Fit |

### LayerFillNoise
#### LayerFillNoise

| Property | Value | Description |
|-------------------|------------------------|-------------------------------------------------|
Expand All @@ -960,14 +1005,14 @@ Can be either of these fill types:
| `noiseIndex` | `number` | One of `1` (black), `2` (white), `3` (color) |
| `noiseIntensity` | `number` | `0` to `100` intensity level of filling noise |

### LayerBorder
#### LayerBorder

Can be either one of these border types:

- [LayerBorderSolid](#layerbordersolid)
- [LayerBorderGradient](#layerbordergradient)

### LayerBorderSolid
#### LayerBorderSolid

| Property | Value | Description |
|---------------|----------------------------|------------------------------------------------------|
Expand All @@ -976,7 +1021,7 @@ Can be either one of these border types:
| `thickness` | `number` | Size of the border stroke |
| `color` | `LayerColor` | Refer to [LayerColor](#layercolor) |

### LayerBorderGradient
#### LayerBorderGradient

| Property | Value | Description |
|---------------|----------------------------|------------------------------------------------------|
Expand All @@ -985,15 +1030,15 @@ Can be either one of these border types:
| `thickness` | `number` | Size of the border stroke |
| `color` | `LayerGradient` | Refer to [LayerGradient](#layergradient) |

### LayerBorderPosition
#### LayerBorderPosition

| Value | Description |
|---------|-----------------------------|
| `0` | Center |
| `1` | Inside |
| `2` | Outside |

### LayerGradient
#### LayerGradient

| Property | Value | Description |
|----------------------|-----------------------|---------------------------------------------------------|
Expand All @@ -1003,7 +1048,7 @@ Can be either one of these border types:
| `stops` | `LayerGradientStop[]` | List of colors stops for the gradient |
| `ellipseLength` | `number` | Length of a gradient ellipse |

### LayerGradientStop
#### LayerGradientStop

| Property | Value | Description |
|---------------|----------------------|-----------------------------------------------------------|
Expand All @@ -1012,14 +1057,14 @@ Can be either one of these border types:



### LayerShadows
#### LayerShadows

| Property | Value | Description |
|---------------|-------------------------|-------------------------------------------------|
| `outer?` | `LayerShadow[]` | Shadow outside of layer |
| `inner?` | `LayerShadow[]` | Shadow inside of layer |

### LayerShadow
#### LayerShadow

| Property | Value | Description |
|-------------------|---------------------|-------------------------------------------------|
Expand All @@ -1029,7 +1074,7 @@ Can be either one of these border types:
| `x` | `number` | Horizontal coords of a shadow |
| `y` | `number` | Vertical coords of a shadow |

### LayerResizingConstraint
#### LayerResizingConstraint

| Property | Value |
|---------------|-----------------------|
Expand All @@ -1040,23 +1085,23 @@ Can be either one of these border types:
| `fixedWidth?` | `boolean` |
| `fixedHeight?` | `boolean` |

### LayerOverrideData
#### LayerOverrideData

| Property | Value | Description |
|-------------------------|-------------------------------------|-------------------------------------------------|
| `symbolId?` | `boolean` | The id of a symbol that gets overwritten |
| `properties?` | `LayerOverrideProperties` | Properties that the layer will overwrite |
| `[layerId: string]` | `string/Object/LayerOverrideData` | An id of a layer that will be overwritten |

### LayerOverrideProperties
#### LayerOverrideProperties

```js
type LayerOverrideProperties = {
...$Diff<LayerDataProperties, { overrides: * }>
};
```

### LayerDataAsset
#### LayerDataAsset

| Property | Value | Description |
|---------------------|-----------------|-------------------------------------------------|
Expand All @@ -1066,24 +1111,6 @@ Can be either one of these border types:
| `scale` | `string` | Scale of an asset |



### Retrieve layer data

![CLI][cli-icon] ![API][api-icon]

`data.info(LayerVersionDescriptor, RequestOptions): Promise<LayerDataset>`

```js
abstract.data.info({
projectId: "616daa90-1736-11e8-b8b0-8d1fec7aef78",
branchId: "master",
fileId: "51DE7CD1-ECDC-473C-B30E-62AE913743B7",
layerId: "CA420E64-08D0-4B96-B0F7-75AA316B6A19",
sha: "c4e5578c590f5334349b6d7f0dfd4d3882361f1a" // or sha: "latest"
});
```


## Files

A file represents a standard file – in Abstract a file is always loaded from a specific commit `SHA`, or point in time.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"check-ts-types": "tsc abstract-sdk.d.ts --lib es2017,dom,esnext.asynciterable",
"prepare": "./scripts/install-types.sh",
"lint": "eslint . --ignore-path .gitignore",
"test": "jest --coverage --runInBand",
"test": "jest --runInBand",
"prebuild": "rm -rf dist && flow-copy-source -i **/testing.js src dist",
"build": "babel src -d dist --ignore **/testing.js",
"prepublish": "yarn build",
Expand Down
Loading