-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Prati28 <sankhepratiksha3@gmail.com> Signed-off-by: Pratiksha Sankhe <sankhepratiksha3@gmail.com>
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
packages/ecc-client-elixir-drs-filer/src/API/Object/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Description | ||
|
||
See the human-readable [Reference Documentation](https://ga4gh.github.io/data-repository-service-schemas/docs/). | ||
|
||
## postDrsObject | ||
|
||
Posts/Create a new object. | ||
|
||
**API Request Body** | ||
|
||
| Parameter | Type | Description | | ||
| ---------- | ------ | ------------------------------------------------------------------------ | | ||
| `objectData` | object | The data of the object to be posted. | | ||
| | | This should be an object containing the necessary fields for the object. | | ||
| | | Modify the structure according to your object requirements. | | ||
|
||
|
||
 | ||
 | ||
|
31 changes: 31 additions & 0 deletions
31
packages/ecc-client-elixir-drs-filer/src/API/Object/drsAPI.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const postObject = async (baseURL: string, objectData: object) => { | ||
const url = `${baseURL}/objects`; | ||
|
||
try { | ||
const response = await fetch(url, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(objectData), | ||
}); | ||
|
||
if (!response) { | ||
return { | ||
isError: true, | ||
breakpoint: "postObject", | ||
error: "No response from server", | ||
}; | ||
} | ||
|
||
return await response.json(); | ||
} catch (error) { | ||
return { | ||
isError: true, | ||
breakpoint: "postObject", | ||
error, | ||
}; | ||
} | ||
}; | ||
|
||
export { postObject }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "./Object/drsAPI.js"; |