Users come in here to make personalized videos at scale that look & feel 100% real.
(Click on the title to access file and see its fields)
- users
- plans
- workspaces
- folders
- video_instances
- segments
- audio_labels
- audio_variables
- generated_videos
- audio
- actors
- files
- videos
- audio_batch
- audio_batch_data
All of our APIs are located on main.rs and there is a simple API documentations on main.rs in readme section.
We put the API core in src and organize them in three branch.
Title | Description |
handlers | Contains the functions which categorized in multiple files. |
types | Contains the custom data type that we defined as struct and etc. |
units | - |
Note: There is a "mod.rs" file in each branch. They are using for create connection between modules.
The files that contain our main functions for APIs categorized in two branch, handlers and types.
(Click on the file name to access the file)
Handlers | Types | |
1 | actors.rs | actors.rs |
2 | audio_batch_data.rs | audio_batch_data.rs |
3 | audio_batch.rs | audio_batch.rs |
4 | audio.rs | audio.rs |
5 | auth.rs | auth.rs |
6 | csv.rs | csv.rs |
7 | export_csv.rs | - |
8 | folders.rs | folders.rs |
9 | generated_video.rs | generated_video.rs |
10 | new_audio.rs | new_audio.rs |
11 | pipeline.rs | - |
12 | plans.rs | plans.rs |
13 | segments.rs | segments.rs |
14 | template_videos.rs | template_videos.rs |
15 | user.rs | user.rs |
16 | video.rs | video.rs |
17 | workspace.rs | workspaces.rs |
You can have a total look on our APIs in this section. Here, APIs prepared as a list. Also, you can find the sample details you need for calling these APIs.
(Click on the file name to access the file)
API | Method | Function | File | |
1 | /api/auth | POST | GetAuth | auth.rs |
2 | /api/tokenauth | POST | GetTokenAuth | auth.rs |
3 | /api/getuser | GET | GetUser | auth.rs |
4 | /api/pipeline | POST | new_send_to_pipline | pipeline.rs |
5 | /api/server | POST | receive_from_pipline | pipeline.rs |
6 | /api/user | GET | get_user | user.rs |
7 | /api/user | PUT | update_user | user.rs |
8 | /api/workspace | POST | create_workspace | workspace.rs |
9 | /api/workspace | GET | get_workspace | workspace.rs |
10 | /api/workspace | PUT | update_workspace | workspace.rs |
11 | /api/workspace | DELETE | delete_workspace | workspace.rs |
12 | /api/folder | POST | create_folder | folders.rs |
13 | /api/folder | GET | get_folder | folders.rs |
14 | /api/folder | PUT | update_folder | folders.rs |
15 | /api/folder | delete_folder | folders.rs | |
16 | /api/actor | POST | create_actor | actors.rs |
17 | /api/actor | GET | get_actor | actors.rs |
18 | /api/actor | PUT | update_actor | actors.rs |
19 | /api/actor | DELETE | delete_actor | actors.rs |
20 | /api/audio | POST | new_create_and_update_audio | new_audio.rs |
21 | /api/audio | GET | new_get_audio | new_audio.rs |
22 | /api/audio | PUT | new_update_audio2 | new_audio.rs |
23 | /api/audio | DELETE | new_delete_audio | new_audio.rs |
24 | /api/audio_batch | POST | create_batch | audio_batch.rs |
25 | /api/audio_batch | GET | get_batch | audio_batch.rs |
26 | /api/audio_batch | PUT | update_batch | audio_batch.rs |
27 | /api/audio_batch | DELETE | delete_batch | audio_batch.rs |
28 | /api/audio_batch_data | POST | csv_to_db | csv.rs |
29 | /api/audio_batch_data | GET | get_batch_data | audio_batch_data.rs |
30 | /api/fetch_audio | GET | fetch_audio | new_audio.rs |
31 | /api/export_csv | GET | export_as_csv | export_csv.rs |
32 | /api/old_audio | POST | create_audio | audio.rs |
33 | /api/old_audio | GET | get_audio | audio.rs |
34 | /api/old_audio | DELETE | delete_audio | audio.rs |
35 | /api/audio_variable | PUT | update_audio_variable | audio.rs |
36 | /api/audio_label | PUT | update_audio_label | audio.rs |
37 | /api/video_instance | POST | create_video | video.rs |
38 | /api/video_instance | GET | get_video | video.rs |
39 | /api/video_instance | PUT | update_video | video.rs |
40 | /api/video_instance | DELETE | delete_video | video.rs |
41 | /api/video | GET | get_video | template_videos.rs |
42 | /api/fetch_video | GET | fetch_video | template_videos.rs |
43 | /api/fetch_generated_video | GET | fetch_generated_video | generated_video.rs |
44 | /api/segment | POST | create_segment | segments.rs |
45 | /api/segment | GET | get_segment | segments.rs |
46 | /api/segment | PUT | update_segment | segments.rs |
47 | /api/segment | DELETE | delete_segment | segments.rs |
48 | /api/generated_video | GET | get_generated_video | generated_video.rs |
49 | /api/checkout | POST | get_plan_checkout | plans.rs |
50 | /api/plans | GET | get_plans | plans.rs |
51 | /api/customer_portal | POST | customer_portal | plans.rs |
52 | /api/stripe_webhook | POST | stripe_webhook | plans.rs |
53 | /api/signup | POST | signup | auth.rs |
54 | /api/upload_video | POST | upload_video | template_videos.rs |
In this section, you can find which function located in which file.
(Click on the file name to access the file)
File | Types | |
1 | actors.rs | create_actor, update_actor, delete_actor, get_actor |
2 | audio_batch_data.rs | create_batch_data, update_audio_records, get_converted_batch_data, get_batch_data |
3 | audio_batch.rs | create_batch, update_batch, delete_batch, get_batch, |
4 | audio.rs | create_audio |
5 | auth.rs | jwt, GetUser, GetAuth, GetTokenAuth, signup |
6 | csv.rs | csv_to_db, upload_csv, from_csv_to_json, get_csv |
7 | export_csv.rs | export_as_csv |
8 | folders.rs | create_folder, update_folder, delete_folder, get_folder |
9 | generated_video.rs | get_generated_video, fetch_generated_video, |
10 | jwt_authorization.rs | jwt_auth |
10 | new_audio.rs | fetch_audio, new_create_and_update_audio, new_update_audio2, new_delete_audio, new_get_audio |
11 | pipeline.rs | new_send_to_pipline, send_to_pipline, receive_from_pipline, |
12 | plans.rs | get_plan_checkout, customer_portal, stripe_webhook, get_plans, |
13 | segments.rs | create_segment, update_segment, delete_segment, get_segment |
14 | storage.rs | ensure_var, upload_create_video, generate_id, generate_unique_id, retrieve, upload, video_retrieve, |
14 | template_videos.rs | upload_video, get_video, fetch_video |
15 | user.rs | create_user, update_user, get_user, check_user |
16 | video.rs | create_video, update_video, delete_video, get_video |
17 | workspace.rs | create_workspace, update_workspace, delete_workspace, get_workspace |
In this section, you can find the properties or fields for each table.
(click on title to access the file)This file contains the table structure in database for βusersβ.
NULL | Title | Description |
π | id π | uuid β ID for user |
π | stytch_user_id | TEXT β authentication for payments |
π | stripe_customer_id | TEXT β customer ID for βstripeβ |
β | stripe_subscription_id | TEXT β subscription ID for βstripeβ |
β | stripe_subscription_item_id | TEXT β subscription item ID for βstripeβ |
β | stripe_metred_subscription_item_id | TEXT β ID for metred plan that user use in βstripeβ |
β | plan_id | uuid β plan ID that using by user |
β | org_id | uuid β organization ID (option for future) |
π | fullname | TEXT β Full name |
π | username | TEXT β User name |
π | TEXT β Email address | |
π | generated_videos_quota | BIGINT β limit for videos depends on plan ID |
π | generated_videos_used | BIGINT β part of that limit which used by user |
π | not_binded_videos | BIGINT β remaining part of limit that still not use |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
Note: βstripeβ is a payment service we are using.
Note: generated_videos_quota and generated_videos_used are exist on both user and workspace. they are connected to each other but they are not same.
Each user have multiple workspace. the generated_videos_quota and generated_videos_used in user information are limited for the user in all user's workspace. for example if generated_videos_used is 15, the 15 point to the total of all videos in all workspace that created by user. so, maybe the user have 2 workspace and used the 7 videos in "workspace 1" and 8 videos in "workspace 2".
and this is same for generated_videos_quota in users table. so, generated_videos_quota is a limit for total videos in all workspaces of user.
but in workspace, the (1)"generated_videos_quota" and (2)"generated_videos_used" is point to the (1)"limit number of videos" and (2)"number of videos which used" in the specific workspace for user.
based on the example about user table about: user_id= 123 has generated_videos_used = 15 with 7 videos in "workspace 1" and 8 videos in "workspace 2". just imagine we are in "workspace 1". so generated_videos_quota and generated_videos_used are limited to this workspace for user with user_id= 123.
before answer your question about the code, I want to mention to another field in users => "not_binded_videos" this is very important because it's our real limit for videos. why? we have the generated_videos_quota but not_binded_videos is tell us, how many videos remained based on the videos that we used (generated_videos_used)
So about your question. in this code user want to create a workspace. The user enter information for workspace, such as name and also generated_videos_quota. but generated_videos_quota is a limit for user's workspace and should not be more than our real limit. where the real limit? it's on not_binded_videos field.
(click on title to access the file)This file contains the table structure in database for βplansβ.
NULL | Title | Description |
π | id π | uuid β plan ID |
β | stripe_plan_id | TEXT |
β | metred_stripe_plan_id | TEXT |
π | quota | BIGINT β limitation |
π | price | NUMERIC β price for package |
π | is_metred_plan | BOOLEAN |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βworkspacesβ.
NULL | Title | Description |
π | id π | uuid β workspace ID |
π | name | TEXT β name |
π | user_id | uuid β ID for user |
π | parent_videos_quota | BIGINT β (option for the future) |
π | parent_videos_used | BIGINT β (option for the future) |
π | generated_videos_quota | BIGINT β limit for videos depends on plan ID |
π | generated_videos_used | BIGINT β part of that limit which used by user |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
Note: generated_videos_quota and generated_videos_used are exist on both user and workspace. they are connected to each other but they are not same.
Each user have multiple workspace. the generated_videos_quota and generated_videos_used in user information are limited for the user in all user's workspace. for example if generated_videos_used is 15, the 15 point to the total of all videos in all workspace that created by user. so, maybe the user have 2 workspace and used the 7 videos in "workspace 1" and 8 videos in "workspace 2".
and this is same for generated_videos_quota in users table. so, generated_videos_quota is a limit for total videos in all workspaces of user.
but in workspace, the (1)"generated_videos_quota" and (2)"generated_videos_used" is point to the (1)"limit number of videos" and (2)"number of videos which used" in the specific workspace for user.
based on the example about user table about: user_id= 123 has generated_videos_used = 15 with 7 videos in "workspace 1" and 8 videos in "workspace 2". just imagine we are in "workspace 1". so generated_videos_quota and generated_videos_used are limited to this workspace for user with user_id= 123.
before answer your question about the code, I want to mention to another field in users => "not_binded_videos" this is very important because it's our real limit for videos. why? we have the generated_videos_quota but not_binded_videos is tell us, how many videos remained based on the videos that we used (generated_videos_used)
So about your question. in this code user want to create a workspace. The user enter information for workspace, such as name and also generated_videos_quota. but generated_videos_quota is a limit for user's workspace and should not be more than our real limit. where the real limit? it's on not_binded_videos field.
(click on title to access the file)This file contains the table structure in database for βfoldersβ.
NULL | Title | Description |
π | id π | uuid β folder ID |
π | user_id | TEXT β ID of the user |
π | workspace_id | TEXT β ID of the workspace |
β | name | TEXT β folder name |
β | parent_videos | BIGINT β (option for future) |
β | generated_videos | BIGINT β number of generated videos |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βvideo_instancesβ.
NULL | Title | Description |
π | id π | uuid β video_instances ID |
π | name | TEXT β title |
π | user_id | uuid β ID for user |
π | folder_id | uuid β folder ID |
β | video_id | uuid β video ID |
β | actor_id | uuid β actore ID |
β | audio_batch_id | uuid β audio batch ID |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βsegmentsβ.
NULL | Title | Description |
π | id π | uuid β ID for segment |
π | user_id | uuid β ID for user |
π | video_instance_id | uuid β video_instance ID in its table |
π | prefix_time_marker_start | TEXT β prefix start time |
π | prefix_time_marker_end | TEXT β prefix end time |
π | suffix_time_marker_start | TEXT β suffix start time |
π | suffix_time_marker_end | TEXT β suffix start time |
π | audio_variable_column_id | BIGINT β column number for variables |
π | audio_variable_name | TEXT β name of the audio_variable |
π | variable_time_marker_start | TEXT β start time for variable |
π | variable_time_marker_end | TEXT β end time for variable |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
Note: Each segment is a part of the video that users want to insert their data in. So if user have a video with 2 minutes length, and want to add data in 01:23 time and its data be 00:15 sec.
01:23 + 00:15 = 01:38
So, the data will be insert between 01:23 and 01:38. It means the video will divided into three section:
prefix: 00:00 to 01:22 Data: 01:23 to 01:38 Suffix: 01:38 to 02:00
(click on title to access the file)This file contains the table structure in database for βaudio_labelsβ.
NULL | Title | Description |
π | id π | BIGSERIAL β ID for audio_labels |
π | user_id | uuid β ID for user |
π | variable_id | BIGINT β variable ID in audio_variables |
β | row_id | Bigserial β row number |
π | name | TEXT β name of the audio_label |
π | audio_url | TEXT β url for the audio |
π | audio_length | TEXT β length of the audio |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βaudio_variablesβ.
NULL | Title | Description |
π | id π | BIGSERIAL β variable ID |
π | user_id | uuid β ID for user |
π | video_instance_id | BIGINT β ID in video_instances table |
π | name | TEXT β variable name |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βgenerated_videosβ.
NULL | Title | Description |
π | id π | uuid β ID for generated video |
π | audio_lables | TEXT β lable of the audio |
π | name | TEXT β name of the generated video |
π | user_id | uuid β ID for user |
π | batch_id | uuid β batch ID |
π | video_instance_id | uuid β ID in video_instance table |
β | video_url | TEXT β url of the video |
π | status | TEXT β current status |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βaudioβ.
NULL | Title | Description |
π | id | uuid β ID for audio |
π | user_id | uuid β ID for user |
π | actor_id π | uuid β ID for actor |
π | name π | TEXT β name of the audio |
π | url | TEXT β url for the audio |
π | audio_length | TEXT β length of the audio |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βactorsβ.
NULL | Title | Description |
π | id π | uuid β ID for actor |
π | user_id π | uuid β ID for user |
π | name | TEXT β actorβs name |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βfilesβ.
NULL | Title | Description |
π | id | uuid β file ID |
π | user_id π | uuid β ID for user |
π | name π | TEXT β file name |
π | url | TEXT β file url |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βvideosβ.
NULL | Title | Description |
π | id π | uuid β video ID |
π | user_id | uuid β ID for user |
π | name | TEXT |
π | url | TEXT β video url |
π | length | TEXT β video lengtth |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βaudio_batchβ.
NULL | Title | Description |
π | id π | uuid β ID for audio_batch |
π | user_id | uuid β ID for user |
π | name | TEXT β name of the audio_batch |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |
This file contains the table structure in database for βaudio_batch_dataβ.
NULL | Title | Description |
π | id π | uuid β ID of the audio_batch_data |
π | audio_batch_id | uuid β ID of the audio_batch |
π | user_id | uuid β ID of the user |
β | name | TEXT β name of the audio_batch_data |
β | audio_id | uuid β ID of the audio |
β | row_id | BIGINT β row number |
β | column_id | BIGINT β column number |
π | created_at | TIMESTAMP(3) β Created timestamp |
π | updated_at | TIMESTAMP(3) β Updated timestamp |