-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: insert object revision endpoint support
- Loading branch information
1 parent
b9bb438
commit ad65234
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'@cosmicjs/sdk': minor | ||
--- | ||
|
||
add insert objectRevision method |
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
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,18 @@ | ||
import HTTP_METHODS from '../../../constants/httpMethods.constants'; | ||
import { APIConfig, BucketConfig } from '../../../types/config.types'; | ||
import { GenericObject } from '../../../types/generic.types'; | ||
import { requestHandler } from '../../../utils/request.handler'; | ||
import { validateWriteKeyAndReturnHeaders } from '../../../utils/writeKey.validation'; | ||
|
||
let headers: GenericObject; | ||
|
||
export const objectRevisionsChainMethods = ( | ||
bucketConfig: BucketConfig, | ||
apiConfig: APIConfig | ||
) => ({ | ||
async insertOne(objectId: string, data: GenericObject) { | ||
const endpoint = `${apiConfig.apiUrl}/buckets/${bucketConfig.bucketSlug}/objects/${objectId}/revisions`; | ||
headers = validateWriteKeyAndReturnHeaders(bucketConfig.writeKey); | ||
return requestHandler(HTTP_METHODS.POST, endpoint, data, headers); | ||
}, | ||
}); |