Skip to content

Commit baa01ed

Browse files
sgnycknitt
authored andcommitted
Zero-cost bindings to CameraRoll API (#451)
* Zero-cost bindings to CameraRoll API * API change
1 parent c0ec9c5 commit baa01ed

File tree

3 files changed

+160
-0
lines changed

3 files changed

+160
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
id: apis/CameraRoll
3+
title: CameraRoll
4+
wip: true
5+
---
6+
7+
```reason
8+
type getPhotosParams;
9+
10+
[@bs.obj]
11+
external getPhotosParams:
12+
(
13+
~first: int,
14+
~after: string=?,
15+
~groupTypes: [@bs.string] [
16+
| `Album
17+
| `All
18+
| `Event
19+
| `Faces
20+
| `Library
21+
| `PhotoStream
22+
| `SavedPhotos
23+
]
24+
=?,
25+
~groupName: string=?,
26+
~assetType: [@bs.string] [ | `All | `Videos | `Photos]=?,
27+
~mimeTypes: array(string)=?,
28+
unit
29+
) =>
30+
getPhotosParams =
31+
"";
32+
33+
type photoIdentifier = {
34+
.
35+
"node": {
36+
.
37+
"_type": string,
38+
"group_name": string,
39+
"image": {
40+
.
41+
"filename": string,
42+
"uri": string,
43+
"height": float,
44+
"width": float,
45+
"isStored": Js.Nullable.t(bool),
46+
"playableDuration": float,
47+
},
48+
"timestamp": float,
49+
"location":
50+
Js.Nullable.t({
51+
.
52+
"latitude": Js.Nullable.t(float),
53+
"longitude": Js.Nullable.t(float),
54+
"altitude": Js.Nullable.t(float),
55+
"heading": Js.Nullable.t(float),
56+
"speed": Js.Nullable.t(float),
57+
}),
58+
},
59+
};
60+
61+
type photoIdentifiersPage = {
62+
.
63+
"edges": array(photoIdentifier),
64+
"page_info": {
65+
.
66+
"has_next_page": bool,
67+
"start_cursor": Js.Nullable.t(string),
68+
"end_cursor": Js.Nullable.t(string),
69+
},
70+
};
71+
72+
[@bs.module "react-native"] [@bs.scope "CameraRoll"]
73+
external saveToCameraRoll: string => Js.Promise.t(string) = "";
74+
75+
[@bs.module "react-native"] [@bs.scope "CameraRoll"]
76+
external saveToCameraRollOverrideType:
77+
(string, ~_type: [@bs.string] [ | `photo | `video]) => Js.Promise.t(string) =
78+
"";
79+
80+
[@bs.module "react-native"] [@bs.scope "CameraRoll"]
81+
external getPhotos: getPhotosParams => Js.Promise.t(photoIdentifiersPage) =
82+
"";
83+
84+
```
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
type getPhotosParams;
2+
3+
[@bs.obj]
4+
external getPhotosParams:
5+
(
6+
~first: int,
7+
~after: string=?,
8+
~groupTypes: [@bs.string] [
9+
| `Album
10+
| `All
11+
| `Event
12+
| `Faces
13+
| `Library
14+
| `PhotoStream
15+
| `SavedPhotos
16+
]
17+
=?,
18+
~groupName: string=?,
19+
~assetType: [@bs.string] [ | `All | `Videos | `Photos]=?,
20+
~mimeTypes: array(string)=?,
21+
unit
22+
) =>
23+
getPhotosParams =
24+
"";
25+
26+
type photoIdentifier = {
27+
.
28+
"node": {
29+
.
30+
"_type": string,
31+
"group_name": string,
32+
"image": {
33+
.
34+
"filename": string,
35+
"uri": string,
36+
"height": float,
37+
"width": float,
38+
"isStored": Js.Nullable.t(bool),
39+
"playableDuration": float,
40+
},
41+
"timestamp": float,
42+
"location":
43+
Js.Nullable.t({
44+
.
45+
"latitude": Js.Nullable.t(float),
46+
"longitude": Js.Nullable.t(float),
47+
"altitude": Js.Nullable.t(float),
48+
"heading": Js.Nullable.t(float),
49+
"speed": Js.Nullable.t(float),
50+
}),
51+
},
52+
};
53+
54+
type photoIdentifiersPage = {
55+
.
56+
"edges": array(photoIdentifier),
57+
"page_info": {
58+
.
59+
"has_next_page": bool,
60+
"start_cursor": Js.Nullable.t(string),
61+
"end_cursor": Js.Nullable.t(string),
62+
},
63+
};
64+
65+
[@bs.module "react-native"] [@bs.scope "CameraRoll"]
66+
external saveToCameraRoll: string => Js.Promise.t(string) = "";
67+
68+
[@bs.module "react-native"] [@bs.scope "CameraRoll"]
69+
external saveToCameraRollOverrideType:
70+
(string, ~_type: [@bs.string] [ | `photo | `video]) => Js.Promise.t(string) =
71+
"";
72+
73+
[@bs.module "react-native"] [@bs.scope "CameraRoll"]
74+
external getPhotos: getPhotosParams => Js.Promise.t(photoIdentifiersPage) =
75+
"";

0 commit comments

Comments
 (0)