@osdk/typescript-sdk-docs 0.5.0-beta.3 → 0.5.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @osdk/typescript-sdk-docs
2
2
 
3
+ ## 0.5.0-beta.4
4
+
5
+ ### Minor Changes
6
+
7
+ - dd8c385: Update upload media ontology edits docs
8
+
3
9
  ## 0.5.0-beta.3
4
10
 
5
11
  ### Minor Changes
@@ -554,6 +554,9 @@ export const snippets = {
554
554
  "subscribeToObjectSetInstructions": [{
555
555
  "template": "import { {{objectOrInterfaceApiName}} } from \"{{{packageName}}}\";\n// Edit this import if your client location differs\nimport { client } from \"./client\";\n\nconst subscription = client({{objectOrInterfaceApiName}}).subscribe(\n {\n onChange(update) {\n if (update.state === \"ADDED_OR_UPDATED\") {\n // An object has received an update or an object was added to the object set\n // Get the object using the $primaryKey from your cache\n // const currentObject = objects[update.object.$primaryKey];\n // use the update.object[\"<propertyName>\"] to update your cache \n //currentObject[\"<propertyName>\"] = update.object[\"<propertyName>\"] ?? currentObject[\"<propertyName>\"];\n }\n else if (update.state === \"REMOVED\") {\n // The object was removed from the object set, which could mean it was deleted or no longer meets the filter criteria\n // Remove the object from your cache using the $primaryKey\n // delete objects[update.object.$primaryKey];\n }\n },\n onSuccessfulSubscription() {\n // The subscription was successful and you can expect to receive updates\n },\n onError(err) {\n // There was an error with the subscription and you will not receive any more updates\n throw new Error(err.error instanceof Error ? err.error.message : String(err.error));\n },\n onOutOfDate() {\n // We could not keep track of all changes. Please reload the objects in your set.\n },\n },\n { properties: [ {{{propertyNames}}} ] }\n);\n\n// To stop receiving updates, call unsubscribe\nsubscription.unsubscribe();"
556
556
  }],
557
+ "uploadMediaOntologyEdits": [{
558
+ "template": "// Upgrade to 2.6 for official support"
559
+ }],
557
560
  "uploadMedia": [{
558
561
  "template": "import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\nimport { {{objectType}}, {{actionApiName}} } from \"{{{packageName}}}\"\n// Edit this import if your client location differs\nimport { client } from \"./client\";\nimport type { MediaReference } from \"@osdk/api\";\n// To upload media with 2.x, it has to be linked to an Action call\nasync function createMediaReference() {\n const file = await fetch(\"file.json\");\n const data = await file.blob();\n // Upload media to an object type with a media property. This returns a media reference that can passed to\n // a media parameter in an Action.\n return await client(\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n ).createMediaReference({\n data,\n fileName: \"myFile\",\n objectType: {{objectType}},\n propertyType: \"{{property}}\",\n });\n}\nconst mediaReference: MediaReference = await createMediaReference();\nconst actionResult = client({{actionApiName}}).applyAction({ \n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{mediaParameter}}: mediaReference \n});",
559
562
  "computedVariables": ["propertyValueV2"]
@@ -591,7 +594,7 @@ export const snippets = {
591
594
  "computedVariables": ["actionParameterSampleValuesV2"]
592
595
  }],
593
596
  "uploadMediaOntologyEdits": [{
594
- "template": "import type { Client } from \"@osdk/client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\nimport type { Edits } from \"@osdk/functions\";\nimport { createEditBatch, uploadMedia } from \"@osdk/functions\";\n\nasync function createObject(client: Client): Promise<Edits.Object<{{objectType}}>[]> {\n const batch = createEditBatch<Edits.Object<{{objectType}}>>(client);\n \n const blob = new Blob([\"Hello, world\"], { type: \"text/plain\" });\n const mediaReference = await uploadMedia(client, { data: blob, fileName: \"foundryFile.txt\" });\n\n // @ts-ignore\n batch.create({{objectType}}, {\n // \"<mediaProperty>\": mediaReference,\n });\n\n return batch.getEdits();\n}\n\nexport default createObject;"
597
+ "template": "import type { Client } from \"@osdk/client\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\nimport type { Edits } from \"@osdk/functions\";\nimport { createEditBatch, uploadMedia } from \"@osdk/functions\";\n\nasync function createObject(client: Client): Promise<Edits.Object<{{objectType}}>[]> {\n const batch = createEditBatch<Edits.Object<{{objectType}}>>(client);\n \n const blob = new Blob([\"Hello, world\"], { type: \"text/plain\" });\n const mediaReference = await uploadMedia(client, { data: blob, fileName: \"foundryFile.txt\" });\n\n // @ts-ignore\n batch.create({{objectType}}, {\n // Set required properties here...\n // Media properties can be set to `mediaReference`\n });\n\n return batch.getEdits();\n}\n\nexport default createObject;"
595
598
  }]
596
599
  }
597
600
  }