Skip to content

Commit

Permalink
test-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
roopksaini committed Oct 28, 2024
1 parent d4de6e7 commit bc41e57
Show file tree
Hide file tree
Showing 4 changed files with 330 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/storage/file/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Interact with files inside a storage repository.
- [itp storage file delete](docs/storage/file/delete.md)
- [itp storage file info](docs/storage/file/info.md)
- [itp storage file list](docs/storage/file/list.md)
- [itp storage file upload](docs/storage/file/upload.md)
- [itp storage file update-content](docs/storage/file/update-content.md)
- [itp storage file update-complete](docs/storage/file/update-complete.md)
27 changes: 27 additions & 0 deletions docs/storage/file/upload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# itp storage file upload

Upload a new file to a specified URL within iTwin storage.

## Options

- **`--uploadUrl`**
The URL where the file should be uploaded.
**Type:** `string` **Required:** Yes

- **`--filePath`**
The path to the file you want to upload.
**Type:** `string` **Required:** Yes

## Examples

```bash
# Example 1: Upload a PDF file to the storage
itp storage file upload --uploadUrl "https://example.com/upload-url" --filePath "/path/to/your/file.pdf"

# Example 2: Upload an image file to the storage
itp storage file upload --uploadUrl "https://example.com/image-upload-url" --filePath "/path/to/your/image.jpg"
```

## API Reference

[Upload File](https://developer.bentley.com/apis/storage/operations/upload-file/)
38 changes: 28 additions & 10 deletions docs/user-stories/itwin-upload-files-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

## Scenario

As a user, I want to upload project-related PDFs, like floor plans, to iTwin storage by accessing the root folder, setting up a dedicated "floor plans" folder, uploading the PDF, and then confirming that it’s successfully stored by checking the folder contents.
As a user, I want to upload project-related PDFs, like floor plans, to iTwin storage by accessing the root folder, setting up a dedicated "floor plans" folder, uploading the PDF in multiple steps, and then confirming that it’s successfully stored by checking the folder contents.

## Steps

1. **Create an iTwin**: Start by creating a new iTwin for managing the project.
2. **Get the root folder**: Retrieve the root folder of the iTwin storage where you will create the new folder.
3. **Create a folder called “floor plans”**: Add a new folder specifically for storing floor plan PDFs.
4. **Upload the floorplan.pdf**: Upload the PDF file into the "floor plans" folder.
5. **Confirm the upload**: View the folder contents to ensure the PDF was uploaded successfully.
4. **Create the file record**: Set up a record for the new file in the "floor plans" folder in iTwin storage.
5. **Upload the floorplan.pdf**: Upload the actual PDF data into the file record.
6. **Complete the upload**: Confirm that the upload process has completed successfully.
7. **Confirm the upload**: View the folder contents to ensure the PDF was uploaded successfully.

## Commands Used

Expand All @@ -24,7 +26,13 @@ As a user, I want to upload project-related PDFs, like floor plans, to iTwin sto
Creates a new folder in the iTwin’s storage.

- `itp storage file create`
Uploads a file (e.g., PDF) to the specified folder.
Creates a file record in the specified folder.

- `itp storage file upload`
Uploads file data to the specified upload URL.

- `itp storage file update-complete`
Marks the file upload as complete in iTwin storage.

- `itp storage file list`
Lists the contents of a folder to confirm that the upload was successful.
Expand All @@ -43,22 +51,32 @@ itp storage root-folder --iTwinId "your-itwin-id"

**Step 3: Create a folder called "floor plans"**
```bash
itp storage folder create --iTwinId "your-itwin-id" --parentId "root-folder-id" --displayName "Floor Plans"
itp storage folder create --parentFolderId "root-folder-id" --displayName "Floor Plans"
```

**Step 4: Create the file record**
```bash
itp storage file create --folderId "your-folder-id" --displayName "floorplan.pdf"
```

**Step 5: Upload the floorplan.pdf**
```bash
itp storage file upload --uploadUrl "https://example.com/upload-url" --filePath "/path/to/floorplan.pdf"
```

**Step 4: Upload the floorplan.pdf**
**Step 6: Complete the upload**
```bash
itp storage file create --iTwinId "your-itwin-id" --folderId "your-folder-id" --filePath "/path/to/floorplan.pdf"
itp storage file update-complete --fileId "your-file-id"
```

**Step 5: Confirm the upload by viewing the folder contents**
**Step 7: Confirm the upload by viewing the folder contents**
```bash
itp storage file list --iTwinId "your-itwin-id" --folderId "your-folder-id"
itp storage file list --folderId "your-folder-id"
```

## Expected Outcome

By following these steps, you will have created an iTwin, organized a "floor plans" folder in the iTwin’s storage, uploaded the floorplan PDF, and confirmed the upload by viewing the folder's contents.
By following these steps, you will have created an iTwin, organized a "floor plans" folder in the iTwin’s storage, created a file record for the PDF, uploaded the PDF in multiple steps, and confirmed the upload by viewing the folder's contents.

## Next Steps

Expand Down
Loading

0 comments on commit bc41e57

Please sign in to comment.