Edits history of script submission #18829 for ' Create a document sequence (sage_intacct)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type SageIntacct = {
    	token: string
    }
    /**
     * Create a document sequence
     * Creates a new document sequence.
     */
    export async function main(
    	auth: SageIntacct,
    	body: {
    		key?: string
    		id?: string
    		printTitle?: string
    		type?: 'numeric' | 'alpha'
    		fixedLength?: string
    		fixedPrefix?: string
    		prefixSeparator?: string
    		fixedSuffix?: string
    		suffixSeparator?: string
    		startingNumber?: number
    		endingNumber?: number
    		nextNumber?: number
    		startingSequence?: string
    		endingSequence?: string
    		nextSequence?: string
    		whenModified?: string
    		entity?: { key?: string; id?: string; name?: string; href?: string }
    		rollover?: {
    			isEnabled?: false | true
    			enabledDate?: string
    			fiscalYearAffixPosition?: 'none' | 'prefix' | 'suffix'
    			separator?: string
    			fiscalYears?: {
    				key?: string
    				id?: string
    				href?: string
    				documentSequence?: { key?: string; id?: string; href?: string }
    				fiscalYear?: number
    				nextNumber?: number
    				nextSequence?: string
    				audit?: {
    					createdDateTime?: string
    					modifiedDateTime?: string
    					createdBy?: string
    					modifiedBy?: string
    				}
    			}[]
    		}
    		status?: 'active' | 'inactive'
    		href?: string
    		audit?: {
    			createdDateTime?: string
    			modifiedDateTime?: string
    			createdBy?: string
    			modifiedBy?: string
    		}
    	} & {}
    ) {
    	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/document-sequence`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.token
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago