File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export function Entry (http, data) {
2525 this . urlPath = `/content_types/${ this . content_type_uid } /entries`
2626
2727 if ( data && data . entry ) {
28+ this . apiVersion = data . api_version || undefined ;
29+ if ( this . apiVersion ) {
30+ this . stackHeaders . api_version = this . apiVersion ;
31+ }
2832 Object . assign ( this , cloneDeep ( data . entry ) )
2933 this . urlPath = `/content_types/${ this . content_type_uid } /entries/${ this . uid } `
3034
Original file line number Diff line number Diff line change @@ -147,12 +147,16 @@ export function ContentType (http, data = {}) {
147147 * client.stack({ api_key: 'api_key'}).contentType('content_type_uid').entry('entry_uid').fetch()
148148 * .then((contentType) => console.log(contentType))
149149 */
150- this . entry = ( uid = null ) => {
150+ this . entry = ( uid = null , options = { } ) => {
151151 const data = { stackHeaders : this . stackHeaders }
152152 data . content_type_uid = this . uid
153153 if ( uid ) {
154154 data . entry = { uid : uid }
155155 }
156+ options = options || { } ; // Ensure `options` is always an object
157+ if ( options && typeof options === 'object' && options . api_version ) {
158+ data . api_version = options . api_version ;
159+ }
156160 return new Entry ( http , data )
157161 }
158162
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ export interface BulkOperation extends SystemFields {
66 publish ( config : BulkOperationConfig ) : Promise < Response >
77 unpublish ( config : BulkOperationConfig ) : Promise < Response >
88 delete ( config : BulkDeleteConfig ) : Promise < Response >
9- addItems ( config : AddItemsConfig ) : Promise < Response >
10- updateItems ( config : AddItemsConfig ) : Promise < Response >
9+ addItems ( config : BulkAddItemsConfig ) : Promise < Response >
10+ updateItems ( config : BulkAddItemsConfig ) : Promise < Response >
1111 jobStatus ( config : BulkJobStatus ) : Promise < Response >
1212}
1313export interface BulkOperationConfig {
Original file line number Diff line number Diff line change @@ -4,10 +4,8 @@ import { Entries, Entry } from "./entry";
44
55export interface ContentType extends SystemFields , SystemFunction < ContentType > {
66 entry ( ) : Entries
7- entry ( uid : string ) : Entry
7+ entry ( uid : string , options ?: { api_version : number | string } ) : Entry
88}
9-
10-
119
1210export interface ContentTypes extends Queryable < ContentType , { content_type : ContentTypeData } > {
1311 import ( data : { content_type : string } , params ?: any ) : Promise < ContentType >
You can’t perform that action at this time.
0 commit comments