From ee0f8a1460f08087527d18c111fbb19358e5a06f Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:15:22 +0200 Subject: [PATCH 01/11] Added type definitions for Sdk.Soap.js --- sdk.soap/sdk.soap-tests.ts | 11 + sdk.soap/sdk.soap.d.ts | 2203 ++++++++++++++++++++++++++++++++++++ 2 files changed, 2214 insertions(+) create mode 100644 sdk.soap/sdk.soap-tests.ts create mode 100644 sdk.soap/sdk.soap.d.ts diff --git a/sdk.soap/sdk.soap-tests.ts b/sdk.soap/sdk.soap-tests.ts new file mode 100644 index 0000000000..78deb50fb6 --- /dev/null +++ b/sdk.soap/sdk.soap-tests.ts @@ -0,0 +1,11 @@ +/// + +var query = new Sdk.Query.QueryByAttribute( "account" ); +query.addColumn( "accountnumber" ); +query.addAttributeValue( new Sdk.String( "name", "acme" ) ); +Sdk.Q.retrieveMultiple( query ).then( entityCollection => +{ + var first = entityCollection.getEntities().getByIndex( 0 ); + var accountNumber = first.getAttributes().getAttributeByName( "accountnumber" ); + console.log( "Account 'acme' has the Account Number '" + accountNumber + "'" ); +} ); \ No newline at end of file diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts new file mode 100644 index 0000000000..b450fd481e --- /dev/null +++ b/sdk.soap/sdk.soap.d.ts @@ -0,0 +1,2203 @@ +// Type definitions for Sdk.Soap.js +// Project: https://code.msdn.microsoft.com/SdkSoapjs-9b51b99a +// Definitions by: Markus Mauch +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Sdk +{ + interface IEntityView + { + attributes: AttributeCollection; + entityState: EntityState; + id: string; + logicalName: string; + relatedEntities: RelatedEntityCollection; + } + + interface IEntityCollectionView + { + entityName: string; + entities: Array; + minActiveRowVersion: string; + moreRecords: boolean; + pagingCookie: string; + totalRecordCount: number; + totalRecordCountLimitExceeded: boolean; + } + + interface IEntityReferenceView + { + Id: string; + Type: string; + Name: string; + } + + interface IEntityReferenceCollectionView extends Array + { } + + class ColumnSet + { + /** + * Specifies the attributes for which non- null values are returned from a query. + * @param columns Comma separated string values for attribute logical names. + */ + constructor( ...columns: string[] ); + + /** + * Specifies the attributes for which non- null values are returned from a query. + * @param columns An Array of string values. + */ + constructor( columns: string[] ); + + /** + * Specifies the attributes for which non- null values are returned from a query. + * @param allColumns If Boolean true value is passed as the first parameter all columns will be included. (Not recommended for production code). + */ + constructor( allColumns: boolean ); + + /** + * Gets the collection of column names. + * @returns The collection of column names. + */ + getColumns(): Sdk.Collection; + + /** + * Adds a column to the collection. + * @param column The logical name of the attribute to add. + */ + addColumn( column: string ); + + /** + * Adds a string array of column names. + * @param columns A string array of column names. + */ + addColumns( columns: Array ); + + /** + * Sets the AllColumns property. + * @params allColumns A boolean value. + */ + setAllColumns( allColumns: boolean ); + + /** + * Whether all columns will be returned. + */ + getAllColumns(): boolean; + + /** + * Gets the number of columns. + */ + getCount(): number; + + + /// prototype methods + + /** + * Removes a column from the ColumnSet. + * @param columnName The logical name of an attribute to be removed from the ColumnSet. + * @param errorIfNotFound Whether to throw an error when the column to remove is not found. The default is false + */ + removeColumn( columnName: string, errorIfNotFound?: boolean ): void; + + /** + * The XML node with "" as the root element. + */ + toXml(): string; + + /** + * XML nodes for columnSet properties. + */ + toValueXml(): string; + } + + class ValueType + { + + } + + class Collection + { + /** + * A Collection for a specified type. + * @param type The function that specifies the type. + * @param items An array of items to add to the collection. + */ + constructor( type: T, items?: Array ); + + /** + * Gets the type defined for the collection. + */ + getType(): T; + + /** + * Adds an item to the collection. + * @param item An item to add to the collection. + */ + add( item: T ): void; + + /** + * Adds an array of objects to the collection. + * @param items An array of items to add to the collection. + */ + addRange( items ): void; + + /** + * Removes all items from the collection. + */ + clear(): void; + + /** + * Returns whether an object exists within the collection. + * @param item The item to search in the collection. + */ + contains( item: T ): boolean; + + /** + * Applies the action contained within a delegate function. + * @param fn Delegate function with parameters for item and index. + */ + forEach( fn: ( item: T, index: number ) => any ); + + /** + * Gets the item in the collection at the specified index. + * @param index The index of the item to return. + */ + getByIndex( index: number ): T; + + /** + * Removes an item from the collection. + * @param item The item to be removed. + */ + remove( item: T ): void; + + /** + * Gets a copy of the array of items in the collection. + */ + toArray(): Array; + + /** + * Returns the number of items in the collection. + */ + getCount(): number; + } + + class EntityCollection + { + /** + * Contains a collection of entity instances. + * @param entities Initializes a new instance of the EntityCollection class setting the Sdk.Collection of Sdk.Entity objects. + */ + constructor( entities: Sdk.Collection ); + + /** + * Adds an entity to the collection. + * @param entity + */ + addEntity( entity: Sdk.Entity ): void; + + /** + * Gets the collection of entities. + */ + getEntities(): Sdk.Collection; + + /** + * Gets an entity in the collection. + * @param indexOrId The index or Id of the entity in the collection. + */ + getEntity( indexOrId: string | Sdk.Guid ): Sdk.Entity; + + /** + * Sets an item in the collection. + * @param indexOrId The index or Sdk.Guid id of the entity in the collection. + * @param value The Sdk.Entity value to set. + */ + setEntity( indexOrId: string | Sdk.Guid, value: Sdk.Entity ): void; + + /** + * Gets the logical name of the entity. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity. + * @param name The logical name of the entity. + */ + setEntityName( name: string ): void; + + /** + * Gets the lowest active row version value. + */ + getMinActiveRowVersion(): string; + + /** + * Sets the lowest active row version value. + * @param minActiveRowVersion The lowest active row version value. + */ + setMinActiveRowVersion( minActiveRowVersion: string ): void; + + /** + * Gets whether there are more records available. + */ + getMoreRecords(): boolean; + + /** + * Sets whether there are more records available. + * @param moreRecords Whether there are more records available. + */ + setMoreRecords( moreRecords: boolean ): void; + + /** + * Gets the current paging information. + */ + getPagingCookie(): string; + + /** + * Sets the current paging information. + * @param pagingCookie The current paging information. + */ + setPagingCookie( pagingCookie: string ): void; + + /** + * Gets the total number of records in the collection if ReturnTotalRecordCount was true when the query was executed. + */ + getTotalRecordCount(): number; + + /** + * Sets the total number of records in the collection if ReturnTotalRecordCount was true when the query was executed. + * @param totalRecordCount The total number of records in the collection if ReturnTotalRecordCount was true when the query was executed. + */ + setTotalRecordCount( totalRecordCount: number ): void; + + /** + * Gets whether the results of the query exceeds the total record count. + */ + getTotalRecordCountLimitExceeded(): boolean; + + /** + * Sets whether the results of the query exceeds the total record count. + * @param totalRecordCountLimitExceeded Whether the results of the query exceeds the total record count. + */ + setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ); + + /** + * XML definition of an the child nodes of an entity. + */ + toValueXml(): string; + + /** + * Returns a view of the entity collection + */ + view(): IEntityCollectionView; + } + + class EntityReferenceCollection + { + /** + * Contains a collection of EntityReference instances. + * @param entityReferences Initializes a new instance of the EntityReferenceCollection class setting the Sdk.Collection of Sdk.EntityReference objects. + */ + constructor( entityReferences?: Sdk.Collection ); + + /** + * Gets the collection of entity references. + */ + getEntityReferences(): Sdk.Collection; + + /** + * Sets the collection of entity references. + * @param entityReferences The entity references + */ + setEntityReferences( entityReferences: Sdk.Collection ); + + + /// prototype methods + + /** + * Removes an entity reference to the collection. + * @param entityReference The entity reference to remove. + */ + remove( entityReference: Sdk.EntityReference ); + + /** + * Returns a view of the data in an entity reference collection instance. + */ + view(): IEntityReferenceCollectionView; + + /** + * Returns the values of serialized entity reference collection as XML nodes. + */ + toValueXml(): string; + } + + class RelatedEntityCollection extends EntityCollection + { + + } + + class AttributeCollection extends Collection + { + /** + * Adds an attribute to the Attribute Collection. + * @param attribute The attribute to add. + * @param isChanged Override the the attribute IsChanged value. + */ + add( attribute: AttributeBase, isChanged?: boolean ): void; + + /** + * Gets the attributes in the collection. + */ + getAttributes(): Collection; + + + /// prototype methods + + /** + * Allows for a delegate function to be applied to each attribute in the collection. + * @param fm The function to be applied. Function should have parameters for the attribute and the iterator i.e.: '(att,i)' + */ + forEach( fn: ( attribute: AttributeBase, index: number ) => any ): void; + + /** + * Returns all attributes in the collection. + */ + get(): Sdk.Collection; + + /** + * Returns the attribute with matching name. + * @param attribuetName + */ + get( attribuetName: string ): AttributeBase; + + /** + * Returns the attribute with matching index. + * @param attribuetName + */ + get( index: number ): AttributeBase; + + /** + * Gets an attribute at a given index. + * @param index The index. + */ + getAttributeByIndex( index: number ): AttributeBase; + + /** + * Gets an attribute with a given name. + * @param name The Logical name of the attribute. + */ + getAttributeByName( name: string ): AttributeBase; + + /** + * Gets an array of the names of attributes in a collection. + */ + getNames(): Array; + /** + * The XML for an attribute collection. + */ + toXml( action: string ): string; + } + + class FormattedValueCollection + { + } + + class RelatedEntitiesCollection + { + } + + class AttributeBase + { + /** + * Gets whether the value of the attribute has changed. + */ + getIsChanged(): boolean; + + /** + * Gets the logical name of the attribute. + */ + getName(): string; + + /** + * Gets the value type of the attribute. + */ + getType(): Sdk.ValueType; + + /** + * Gets the value of the attribute. + * The type of value depends on the type of attribute. + */ + getValue(): any; + + /** + * Whether the value of the attribute is set. + */ + isValueSet(): boolean; + + /** + * Sets whether the value of the attribute has changed. + * @param isChanged Whether the value of the attribute has changed. + */ + setIsChanged( isChanged: boolean ): void; + + /** + * Sets the name of the attribute + * @param name The name of the attribute. + */ + setName( name: string ): void; + + /** + * For internal use only. + * @param type The type of the attribute. + */ + setType( type: Sdk.ValueType ): void; + + /** + * Internal Use Only + */ + setValidValue( value ); + + + /// prototype methods + + /** + * XML node for Attribute. + */ + toXml( action ): string; + } + + class Boolean extends AttributeBase + { + /** + * A Boolean Attribute. + * @param name The logical name of the attribute . + * @param value The value of the managed property. + */ + constructor( name: string, value?: boolean ) + + /** + * Gets the value of a Boolean attribute. + */ + getValue(): boolean; + + /** + * Sets the value of a Boolean attribute. + * @param value + */ + setValue( value: boolean ): void; + } + + class DateTime extends AttributeBase + { + /** + * A DateTime Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: Date ); + + /** + * Gets the value of a DateTime attribute. + */ + getValue(): Date; + + /** + * Sets the value of a DateTime attribute. + * @param value The value to set. + */ + setValue( value: Date ): void; + } + + class Decimal extends AttributeBase + { + /** + * A Decimal Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Decimal attribute. + */ + getValue(): number; + + /** + * Sets the value of a Decimal attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Double + { + /** + * A Double Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Double attribute. + */ + getValue(): number; + + /** + * Sets the value of a Double attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Guid extends AttributeBase + { + /** + * A Guid Attribute. + * @param name The logical name of the attribute. + * @param value" The value of the attribute + */ + constructor( name: string, value?: string ); + + /** + * Gets the value of a Guid attribute. + */ + getValue(): string; + + /** + * Sets the value of a Guid attribute. + * @param value The value to set. + */ + setValue( value: string ): void; + } + + class Int extends AttributeBase + { + /** + * An Integer Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of an Integer attribute. + */ + getValue(): number; + + /** + * Sets the value of an Integer attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Long extends AttributeBase + { + /** + * A Long Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Long attribute. + */ + getValue(): number; + + /** + * Sets the value of a Long attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Lookup extends AttributeBase + { + /** + * A Lookup Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: EntityReference ); + + /** + * Gets the value of a Lookup attribute. + */ + getValue(): EntityReference; + + /** + * Sets the value of a Lookup attribute. + * @param value The value to set. + */ + setValue( value: EntityReference ): void; + } + + class Money extends AttributeBase + { + /** + * A Money Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Money attribute. + */ + getValue(): number; + + /** + * Sets the value of a Money attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class OptionSet extends AttributeBase + { + /** + * An OptionSet Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a OptionSet attribute. + */ + getValue(): number; + + /** + * Sets the value of an OptionSet attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class PartyList extends AttributeBase + { + /** + * A PartyList Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: EntityCollection ); + + /** + * Gets the value of a PartyList attribute. + */ + getValue(): EntityCollection; + + /** + * Sets the value of a PartyList attribute. + * @param value The value to set. + */ + setValue( value: EntityCollection ): void; + } + + class String extends AttributeBase + { + /** + * A String Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: string ); + + /** + * Gets the value of a String attribute. + */ + getValue(): string; + + /** + * Sets the value of a String attribute. + * @param value The value to set. + */ + setValue( value: string ): void; + } + + class EntityState + { } + + class Entity + { + /** + * Represents an instance of an entity (a record). + * @param type The logical name of the entity. + */ + constructor( type: string ); + + /** + * Gets the collection of attributes for the entity. + */ + getAttributes(): Sdk.AttributeCollection; + + /** + * Gets the collection of attributes for the entity. + * @param attributeName The attribute with matching name is returned. + */ + getAttributes( attributeName: string ): Sdk.AttributeCollection; + + /** + * Gets the collection of attributes for the entity. + * @param index The attribute with matching index is returned. + */ + getAttributes( index: number ): Sdk.AttributeCollection; + + /** + * Sets the collection of attributes for the entity. + * @param attributes The collection of attributes for the entity. + */ + setAttributes( attributes: Sdk.AttributeCollection ); + + /** + * Gets the state of the entity. + */ + getEntityState(): Sdk.EntityState; + + /** + * Sets the state of the entity. + * @param state The state of the entity. + */ + setEntityState( state: Sdk.EntityState ): void; + + /** + * Gets the collection of formatted values for the entity attributes. + */ + getFormattedValues(): Sdk.FormattedValueCollection; + + /** + * Sets the collection of formatted values for the entity attributes. + * @param values" The collection of formatted values for the entity attributes. + */ + setFormattedValues( values: Sdk.FormattedValueCollection ): void; + + /** + * Gets the Id of the record represented by this entity instance. + */ + getId(): string; + + /** + * Sets the Id of the record represented by this entity instance. + * @param id The Id of the record represented by this entity instance. + * @param override Allow setting the Id property, for example when creating a new record from an existing one. + */ + setId( id: string, override?: boolean ): void; + + /** + * Gets the logical name of the entity. + */ + getType(): string; + + /** + * Sets the logical name of the entity. + * @param type The logical name of the entity. + */ + setType( type ): void; + + /** + * Gets a collection of related entities. + */ + getRelatedEntities(): Sdk.RelatedEntitiesCollection; + + /** + * Sets a collection of related entities. + * @param relatedEntities A collection of related entities. + */ + setRelatedEntities( relatedEntities: Sdk.RelatedEntitiesCollection ): void; + + /** + * Adds an attribute with an optional value to a newly instantiated Sdk.Entity + * @param attribute The attribute to add + * @param isChanged Whether the attribute should be considered changed, the default is true. + */ + addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ); + + /** + * Adds an entity to the related entities. + * @param relationshipSchemaName The relationship SchemaName. + * @param entity The entity to add. + */ + addRelatedEntity( relationshipSchemaName: string, entity: Sdk.Entity ): void; + + /** + * Gets the value to indicate whether data for the entity has changed. + */ + getIsChanged(): boolean; + + /** + * Sets the value to indicate whether data for the entity has changed. + * @param isChanged The value to indicate whether data for the entity has changed. + */ + setIsChanged( isChanged: boolean ); + + /** + * Gets the value of the specified attribute. + * @param logicalName The logical name of the attribute. + */ + getValue( logicalName: string ): Object; + + /** + * Generates properties for the entity based on metadata. + */ + initializeSubClass( metadata ); + + /** + * Sets the value of the specified attribute. + * @param logicalName The logical name of the attribute. + * @param value The value for the attribute. Simple JavaScript types may be used for most attribute types. Sdk.EntityReference, Sdk.EntityCollection, and Sdk.BooleanManagedPropertyValue cannot use simple JavaScript types. + */ + setValue( logicalName: string, value: Object ): void; + + /** + * Generates an entity reference. + */ + toEntityReference(): Sdk.EntityReference; + + /** + * Overrides the default toString method. + */ + toString(): string; + + /** + * XML definition of an the child nodes of an entity. + * @param action + */ + toValueXml( action ): string; + + /** + * XML definition of an entity where the root node is . + */ + toXml( action ): string; + + /** + * Returns a view of the data in an entity instance + */ + view(): IEntityView; + } + + class EntityReference + { + /** + * Identifies a record. + * @param logicalName The logical name of the entity. + * @param id The id of the record. + * @param name The value of the primary attribute of the entity instance. This property can contain a value or null. This property is not automatically populated unless the EntityReference object has been retrieved from the server. + */ + constructor( logicalName: string, id: string, name?: string ); + + /** + * Gets the logicalName representing the type of referenced entity. + */ + getType(): string; + + /** + * Gets the Id value of the referenced entity. + */ + getId(): string; + + /** + * Gets the primary attribute value of the referenced entity. + */ + getName(): string; + + /** + * Sets the logicalName representing the type of referenced entity. + * @param type The logicalName representing the type of referenced entity. + */ + setType( type: string ): void; + + /** + * Sets the Id value of the entity. + * @param id The Id value of the entity. + */ + setId( id: string ): void; + + /** + * Sets the primary attribute value of the referenced entity. + * @param name The primary attribute value of the referenced entity. + */ + setName( name: string ): void; + + + /// prototype methods + + /** + * Returns a serialized entity reference where the root element is . + */ + toXml(): string; + + /** + * Returns the values of serialized entity reference as XML nodes. + */ + toValueXml(): string; + + /** + * Returns a view of the data in an EntityReference + */ + view(): IEntityReferenceView; + } + + class OrganizationRequest + { } + + class OrganizationResponse + { } + + class Q + { + /** + * Creates a link between records. + * @param entityName The logical name of the entity that is specified in the entityId parameter. + * @param entityId The ID of the record to which the related records are associated. + * @param relationship The name of the relationship to be used to create the link. + * @param relatedEntities A collection of Sdk.EntityReference objects to be associated. + */ + static associate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + /** + * Creates an entity record and returns a string representation of the GUID value that is the Id of the created entity. + * @param entity An entity instance. + */ + static create( entity: Sdk.Entity ): Q.Promise; + + /** + * Deletes an entity record + * @param entityName The LogicalName of the entity to delete. + * @param id An ID of the record to delete. + */ + static del( entityName: string, id: string ): Q.Promise; + + /** + * Removes a link between records. + * @param entityName The logical name of the entity that is specified in the entityId parameter. + * @param entityId The ID of the record to which the related records are disassociated. + * @param relationship The name of the relationship to be used to remove the link. + * @param relatedEntities A collection of Sdk.EntityReference objects to be disassociated. + */ + static disassociate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + + /** + * Executes a SOAP Request using the SOAPAction Execute. + * @param request A request object. + */ + static execute( request: Sdk.OrganizationRequest ): Q.Promise; + + /** + * Retrieves an entity instance. + * @param entityName The logical name of the entity to retrieve. + * @param id The id of the entity to retrieve. + * @param columnSet The columns of the entities to retrieve. + */ + static retrieve( entityName: string, id: string, columnSet: Sdk.ColumnSet ): Q.Promise; + + /** + * Retrieves the results of a query + * @param query Either an Sdk.Query.FetchExpression or Sdk.Query.QueryExpression query + */ + static retrieveMultiple( query: Query.QueryBase ): Q.Promise; + + /** + * Updates an entity instance. + * @param entity An entity instance to update. + */ + static update( entity: Entity ): Q.Promise; + } + + /** + * Contains the data that is needed to convert a query in FetchXML to a QueryExpression. + * @param fetchXml Sets the query to convert. + */ + class FetchXmlToQueryExpressionRequest + { + constructor( fetchXml: string ); + + /** + * Sets the query to convert. + * @param The query to convert. + */ + setFetchXml( value: string ): void; + } + + /** + * Response to FetchXmlToQueryExpressionRequest. + * @param responseXml The response XML to the FetchXmlToQueryExpressionRequest. + */ + class FetchXmlToQueryExpressionResponse + { + constructor( responseXml: string ); + + /** + * Gets the results of the query conversion. + */ + public getQuery(): Query.QueryExpression; + } + + +} + +declare module Sdk.Mdq.ValueEnums +{ + export enum OwnershipType + { + None, + OrganizationOwned, + TeamOwned, + UserOwned, + } + + export enum AttributeTypeCode + { + BigInt, + Boolean, + CalendarRules, + Customer, + DateTime, + Decimal, + Double, + EntityName, + Integer, + Lookup, + ManagedProperty, + Memo, + Money, + Owner, + PartyList, + Picklist, + State, + Status, + String, + Uniqueidentifier, + Virtual, + } + + + export enum AttributeRequiredLevel + { + ApplicationRequired, + None, + Recommended, + SystemRequired, + } + + + export enum DateTimeFormat + { + DateAndTime, + DateOnly, + } + + export enum ImeMode + { + Active, + Auto, + Disabled, + Inactive, + } + + + + export enum IntegerFormat + { + Duration, + Language, + Locale, + None, + TimeZone, + } + + + export enum SecurityTypes + { + Append, + Inheritance, + None, + ParentChild, + Pointer, + } + + export enum StringFormat + { + Email, + PhoneticGuide, + Text, + TextArea, + TickerSymbol, + Url, + VersionNumber, + } +} + +declare module Sdk.Query +{ + class QueryBase + { + /** + * Internal Use Only. + * @param type An Abstract class for different query classes to inherit from. + */ + constructor( type: string ); + + /** + * + */ + getQueryType(): string; + } + + class QueryByAttribute extends QueryBase + { + /** + * Initializes a new instance of the QueryByAttribute class setting the entity name. + * @param entityName The logical name of the entity. + * + */ + constructor( entityName: string ); + + /** + * Gets the columns to include. + */ + getColumnSet(): Sdk.ColumnSet; + + /** + * Sets the columns to include. + * @param columns An Sdk.ColumnSet instance. + */ + setColumnSet( columns: Sdk.ColumnSet ): void; + + /** + * Sets the columns to include. + * @param columns An Array of attribute logical names for the columns to return. + */ + setColumnSet( columns: Array ): void; + + /** + * Sets the columns to include. + * @param columns Pass each attribute logical name as an argument. + */ + setColumnSet( ...columns: string[] ): void; + + /** + * Gets the logical name of the entity. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity. + * @param name The logical name of the entity + */ + setEntityName( name: string ); + + /** + * Gets An Sdk.Collection of Sdk.AttributeBase attributes. + */ + getAttributeValues(): Sdk.Collection; + + /** + * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + getOrders(): Sdk.Collection; + + /** + * Sets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + * @param orders An Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + setOrders( orders: Sdk.Collection ); + + /** + * Gets the number of pages and the number of entity instances per page returned from the query. + */ + getPageInfo(): Sdk.Query.PagingInfo; + + /** + * Sets the number of pages and the number of entity instances per page returned from the query. + * @param pageInfo The number of pages and the number of entity instances per page returned from the query. + */ + setPageInfo( pageInfo: Sdk.Query.PagingInfo ); + + /** + * Gets the number of rows to be returned. + */ + getTopCount(): number; + + /** + * Sets the number of rows to be returned. + * @param count The number of rows to be returned. + */ + setTopCount( count: number ); + + + /// prototype methods + + /** + * Adds the attribute with values to include in the query. + * @param attributeValue One of the classes that inherit from Sdk.AttributeBase including the value to use as criteria. + */ + addAttributeValue( attributeValue: Sdk.AttributeBase ): void; + + /** + * Adds a column to the ColumnSet used by the query. + * @param columnName The logical name of an attribute to be returned by the query. + */ + addColumn( columnName: string ): void; + + /** + * Adds an order to apply to the results of the query. + * @param order An order expression. + */ + addOrder( order: Sdk.Query.OrderExpression ): void; + + /** + * Removes an attribute with values to include in the query. + * @param attributeValue One of the classes that inherit from Sdk.AttributeBase including the value to use as criteria. + * @param errorIfNotFound Whether to throw an error when the attribute to remove is not found. The default is false. + */ + removeAttributeValue( attributeValue: Sdk.AttributeBase, errorIfNotFound?: boolean ): void; + + /** + * Removes a column from the ColumnSet used by the query. + * @param columnName The logical name of an attribute to be removed from the ColumnSet. + * @param errorIfNotFound Whether to throw an error when the column to remove is not found. The default is false. + */ + removeColumn( columnName: string, errorIfNotFound?: boolean ): void; + + /** + * Gets the serialized QueryByAttribute. + */ + toXml(): string; + + /** + * Gets the serialized QueryByAttribute values. + */ + toValueXml(): string; + } + + class QueryExpression extends QueryBase + { + /** + * Initializes a new instance of the QueryExpression class setting the entity name. + * @param entityName The name of the entity. + */ + constructor( entityName: string ); + + /** + * Gets the columns to include. + */ + getColumnSet(): Sdk.ColumnSet; + + /** + * Sets the columns to include. + * @param columns An Sdk.ColumnSet instance. + */ + setColumnSet( columns: Sdk.ColumnSet ): void; + + /** + * Sets the columns to include. + * @param columns An Array of attribute logical names for the columns to return. + */ + setColumnSet( columns: Array ): void; + + /** + * Sets the columns to include. + * @param columns Pass each attribute logical name as an argument. + */ + setColumnSet( ...columns: string[] ): void; + + /** + * Gets the complex condition and logical filter expressions that filter the results of the query. + */ + getCriteria: FilterExpression; + + /** + * Sets the complex condition and logical filter expressions that filter the results of the query. + * @param criteria The query condition and filter criteria. + */ + setCriteria( criteria: FilterExpression ): void; + + /** + * Gets whether the results of the query contain duplicate entity instances. + */ + getDistinct(): boolean; + + /** + * Sets whether the results of the query contain duplicate entity instances. + */ + setDistinct( isDistinct: boolean ); + + /** + * Gets the logical name of the entity. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity. + * @param name The logical name of the entity. + */ + setEntityName( name: string ): void; + + /** + * Gets an Sdk.Collection of Sdk.Query.LinkEntity instances. + */ + getLinkEntities(): LinkEntity; + + /** + * Gets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query. + */ + getNoLock(): boolean; + + /** + * Sets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query. + * @param isNoLock True if there are no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query; otherwise, false. + */ + setNoLock( isNoLock: boolean ): void; + + /** + * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + getOrders(): OrderExpression; + + /** + * Gets the number of pages and the number of entity instances per page returned from the query. + */ + getPageInfo(): PagingInfo; + + /** + * Sets the number of pages and the number of entity instances per page returned from the query. + * @param pageInfo The number of pages and the number of entity instances per page returned from the query. + */ + setPageInfo( pageInfo: PagingInfo ): void; + + /** + * Gets the number of rows to be returned. + */ + getTopCount(): number; + + /** + * Sets the number of rows to be returned. + * @param topCount The number of rows to be returned. + */ + setTopCount( topCount: number ): void; + + + /// prototype methods + + /** + * Adds the specified column to the column set. + * @param columnName The logical name of the column to add. + */ + addColumn( columnName: string ): void; + + /** + * Contains a condition expression used to filter the results of the query. + * @param entityName The logical name of the entity in the condition expression. + * @param attributeName The logical name of the attribute in the condition expression. + * @param operator The condition operator. + * @param values The value(s) to compare. Use one of the following classes that inherit from Sdk.Query.ValueBase: + * Sdk.Query.Booleans + * Sdk.Query.BooleanManagedProperties + * Sdk.Query.Dates + * Sdk.Query.Decimals + * Sdk.Query.Doubles + * Sdk.Query.EntityReferences + * Sdk.Query.Guids + * Sdk.Query.Ints + * Sdk.Query.Longs + * Sdk.Query.Money + * Sdk.Query.OptionSets + * Sdk.Query.Strings + */ + addCondition( entityName: string, attributeName: string, conditionOperator: Sdk.Query.ConditionOperator, values: Sdk.Query.ValueBase ): void; + + /** + * Adds the specified link to the query expression setting the entity name to link to, the attribute name to link from and the attribute name to link to. + * @param firstParam An Sdk.Query.LinkEntity instance. + */ + addLink( firstParam: Sdk.Query.LinkEntity ): void; + + /** + * Adds the specified link to the query expression setting the entity name to link to, the attribute name to link from and the attribute name to link to. + * @param firstParam The name of entity to link from. + * @param linkFromAttributeName The name of the attribute to link from. + * @param linkToAttributeName The name of the attribute to link to. + * @param joinOperator The join operator. The default value is Inner + */ + addLink( firstParam: string, linkFromAttributeName: string, linkToAttributeName: string, joinOperator: Sdk.Query.JoinOperator ): void; + + /** + * Adds the specified order expression to the query expression. + * @param attributeName The name of the attribute. + * @param orderType The order, ascending or descending. Ascending is the default if not specified. + */ + addOrder( attributeName: string, orderType: Sdk.Query.OrderType ): void; + + /** + * Gets the serialized QueryExpression. + */ + toXml(): string; + + /** + * Gets the serialized QueryExpression values. + */ + toValueXml(): string; + } + + class OrderExpression + { + } + + class FilterExpression + { + } + + class LinkEntity + { + } + + class PagingInfo + { + /** + * Gets the number of entity instances returned per page. + */ + getCount(): number; + + /** + * Sets the number of entity instances returned per page. + * @param The number of entity instances returned per page + */ + setCount( count: number ): void; + + /** + * Gets the number of pages returned from the query. + */ + getPageNumber(): number; + + /** + * Sets the number of pages returned from the query. + * @param The number of pages returned from the query. + */ + setPageNumber( pages: number ): void; + + /** + * Gets the info used to page large result sets. + */ + getPagingCookie(): string; + + /** + * Sets the info used to page large result sets. + */ + setPagingCookie( cookie: string ): void; + + /** + * Gets whether the total number of records should be returned from the query. + */ + getReturnTotalRecordCount(): boolean; + + /** + * Sets whether the total number of records should be returned from the query. + * @param Specifies whether the TotalRecordCount should be set when the query is executed. + */ + setReturnTotalRecordCount( returnTotalRecordsCount: boolean ): void; + + + /// prototype methods + + /** + * Gets the serialized paging info. + * + toXml():string; + + /** + * Gets the serialized paging info values. + */ + toValueXml(): string; + } + + class Util + { + /** + * Verifies the parameter is a string formatted as a GUID. + * @param value The value to check. + */ + isGuid( value: string ): boolean; + + /** + * Verifies the parameter is a string formatted as a GUID or null. + * @param value The value to check. + */ + isGuidOrNull( value: string ): boolean; + + /** + * Verifies the parameter is a valid enum value. + * @param enumeration The enumeration. + * @param value The value to check. + */ + + /** + * Returns an empty GUID. + */ + getEmptyGuid(): string; + + /** + * Formats a string with the arguments from an array. + * @param string The string containing placeholders for items in the array. + * @param args An array of strings to replace the placeholders. + */ + format( string: string, args: Array ); + + /** + * + */ + getError( resp ): string; + + /** + * Returns the clinent URL. + */ + getClientUrl(): string; + + /** + * Provides a way to override the client Url when a client-side context is not available. + * @param url The client URL to use instead of the default. + */ + setClientUrl( url: string ): void; + + /** + * + */ + getXMLHttpRequest( action, async: boolean ); + + /** + * Creates an entity from XML. + * @param The serialized entity returned from the SOAP service as XML. + */ + createEntityFromNode( node: string ); + } + + class Xml + { + + } + + export enum ConditionOperator + { + Equal, + NotEqual, + GreaterThan, + LessThan, + GreaterEqual, + LessEqual, + Like, + NotLike, + In, + NotIn, + Between, + NotBetween, + Null, + NotNull, + Yesterday, + Today, + Tomorrow, + Last7Days, + Next7Days, + LastWeek, + ThisWeek, + NextWeek, + LastMonth, + ThisMonth, + NextMonth, + On, + OnOrBefore, + OnOrAfter, + LastYear, + ThisYear, + NextYear, + LastXHours, + NextXHours, + LastXDays, + NextXDays, + LastXWeeks, + NextXWeeks, + LastXMonths, + NextXMonths, + LastXYears, + NextXYears, + EqualUserId, + NotEqualUserId, + EqualBusinessId, + NotEqualBusinessId, + Mask, + NotMask, + Contains, + DoesNotContain, + EqualUserLanguage, + NotOn, + OlderThanXMonths, + BeginsWith, + DoesNotBeginWith, + EndsWith, + DoesNotEndWith, + ThisFiscalYear, + ThisFiscalPeriod, + NextFiscalYear, + NextFiscalPeriod, + LastFiscalYear, + LastFiscalPeriod, + LastXFiscalYears, + LastXFiscalPeriods, + NextXFiscalYears, + NextXFiscalPeriods, + InFiscalYear, + InFiscalPeriod, + InFiscalPeriodAndYear, + InOrBeforeFiscalPeriodAndYear, + InOrAfterFiscalPeriodAndYear, + EqualUserOrUserTeams, + EqualUserTeams, + } + + export class JoinOperator + { + constructor(); + } + + export enum OrderType + { + Ascending, + Descending, + } + + export class ValueBase + { } + + /** + * Specifies the Guid values to be compared in the query. + * @param An Array of String values + */ + class Guids extends ValueBase + { + constructor( args: Array ); + } +} + +declare module Sdk +{ + /** + * Request to retrieve metadata and metadata changes. + * @param query The Sdk.Mdq.EntityQueryExpression that defines the query. + * @param clientVersionStamp The Sdk.Mdq.RetrieveMetadataChangesResponse.ServerVersionStamp value from a previous request. When included only the metadata changes since the previous request will be returned. + * @param deletedMetadataFilters An Sdk.Mdq.DeletedMetadataFilters enumeration value. When included the deleted metadata changes will be limited to the types defined by the enumeration. + */ + export class RetrieveMetadataChangesRequest + { + constructor( query: Sdk.Mdq.EntityQueryExpression, clientVersionStamp?: string, deletedMetadataFilters?: Sdk.Mdq.DeletedMetadataFilters ); + getEntityMetadata(): Sdk.Mdq.IEntityMetadata[]; + getServerVersionStamp(): string; + getDeletedMetadata(): Object; + } + + /** + * Response to RetrieveMetadataChangesRequest. + * @param resopnseXml The response XML. + */ + export class RetrieveMetadataChangesResponse + { + constructor( responseXml: string ); + + /*** + * + */ + public getEntityMetadata(): Array; + + /*** + * + */ + public getServerVersionStamp(); + + /*** + * + */ + public getDeletedMetadata(); + } +} + +declare module Sdk.Mdq +{ + /** + * Defines a complex query to retrieve entity metadata. + * @param criteria The filter criteria for the metadata query. + * @param properties The properties to be returned by the query. + * @param attributeQuery A query expression for the entity attribute metadata to return. + * @param relationshipQuery A query expression for the entity relationship metadata to return. + * @param labelQuery A query expression for the labels to return. + */ + export class EntityQueryExpression + { + constructor( + criteria: Sdk.Mdq.MetadataFilterExpression, + properties: Sdk.Mdq.MetadataPropertiesExpression, + attributeQuery?: Sdk.Mdq.AttributeQueryExpression, + relationshipQuery?: Sdk.Mdq.RelationshipQueryExpression, + labelQuery?: Sdk.Mdq.LabelQueryExpression ); + } + + /** + * An enumeration that specifies the type of deleted metadata to retrieve. + */ + export enum DeletedMetadataFilters + { + All, // All deleted metadata + Attribute, // Deleted Attribute metadata + Default, // The value used if not set. Equals Entity + Entity, //Deleted Entity metadata + Label, //Deleted Label metadata + OptionSet, // Deleted OptionSet metadata + Relationship, //Deleted Relationship metadata + } + + /** + * Specifies complex condition and logical filter expressions used for filtering the results of a metadata query. + * @param filterOperator The logical AND/OR filter operator. + */ + export class MetadataFilterExpression + { + constructor( filterOperator: Sdk.Mdq.LogicalOperator ); + + /** + * Adds a condition. This method accepts either the properties to create a new Sdk.Mdq.MetadataConditionExpression or a Sdk.Mdq.MetadataConditionExpression as the first argument. + * @param propertyName The metadata property to evaluate. + * @param conditionOperator The condition operator. + * @param value The metadata value to evaluate. + */ + public addCondition( + propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, + conditionOperator: MetadataConditionOperator, + value: Object ); + } + + /** + * Defines a complex query to retrieve attribute metadata for entities retrieved using an Sdk.Mdq.EntityQueryExpression. + * @param criteria The filter criteria for the metadata query. + * @param properties The properties to be returned by the query. + */ + export class AttributeQueryExpression + { + constructor( criteria: MetadataFilterExpression, properties: Sdk.Mdq.MetadataPropertiesExpression ); + } + + /** + * Defines a complex query to retrieve entity relationship metadata for entities retrieved using an EntityQueryExpression. + * @param criteria The filter criteria for the metadata query. + * @param properties The properties to be returned by the query. + */ + export class RelationshipQueryExpression + { + constructor( criteria: MetadataFilterExpression, properties: Sdk.Mdq.MetadataPropertiesExpression ); + } + + /** + * Defines the languages for the labels to be retrieved for metadata items that have labels. + * @param languages An array of LCID number values. + */ + export class LabelQueryExpression + { + constructor( languages: Array ); + } + + /** + * Logical operator. + */ + export enum LogicalOperator + { + And, + Or, + } + + /** + * Specifies the properties for which non-null values are returned from a query. + * @param allProperties Whether to retrieve all the properties of a metadata object. + * @param propertyNames: >An array of strings representing the metadata properties to retrieve. + */ + export class MetadataPropertiesExpression + { + constructor( allProperties: boolean, propertyNames?: Array ); + } + + export enum RelationshipMetadataProperties + { + AssociatedMenuConfiguration, + CascadeConfiguration, + HasChanged, + Entity1AssociatedMenuConfiguration, + Entity1IntersectAttribute, + Entity1LogicalName, + Entity2AssociatedMenuConfiguration, + Entity2IntersectAttribute, + Entity2LogicalName, + IntersectEntityName, + IsCustomizable, + IntroducedVersion, + IsCustomRelationship, + IsManaged, + IsValidForAdvancedFind, + MetadataId, + ReferencedAttribute, + ReferencedEntity, + ReferencingAttribute, + ReferencingEntity, + RelationshipType, + SchemaName, + SecurityTypes, + } + + export enum AttributeMetadataProperties + { + AttributeOf, + AttributeType, + AttributeTypeName, + CalculationOf, + CanBeSecuredForCreate, + CanBeSecuredForRead, + CanBeSecuredForUpdate, + CanModifyAdditionalSettings, + ColumnNumber, + DefaultFormValue, + DefaultValue, + DeprecatedVersion, + Description, + DisplayName, + EntityLogicalName, + Format, + FormatName, + ImeMode, + IntroducedVersion, + IsAuditEnabled, + IsCustomAttribute, + IsCustomizable, + IsManaged, + IsPrimaryId, + IsPrimaryName, + IsRenameable, + IsSecured, + IsValidForAdvancedFind, + IsValidForCreate, + IsValidForRead, + IsValidForUpdate, + LinkedAttributeId, + LogicalName, + MaxLength, + MaxValue, + MetadataId, + MinValue, + OptionSet, + Precision, + PrecisionSource, + RequiredLevel, + SchemaName, + Targets, + YomiOf, + } + + export enum EntityMetadataProperties + { + ActivityTypeMask, + Attributes, + AutoCreateAccessTeams, + AutoRouteToOwnerQueue, + CanBeInManyToMany, + CanBePrimaryEntityInRelationship, + CanBeRelatedEntityInRelationship, + CanCreateAttributes, + CanCreateCharts, + CanCreateForms, + CanCreateViews, + CanModifyAdditionalSettings, + CanTriggerWorkflow, + Description, + DisplayCollectionName, + DisplayName, + IconLargeName, + IconMediumName, + IconSmallName, + IntroducedVersion, + IsActivity, + IsActivityParty, + IsAIRUpdated, + IsAuditEnabled, + IsAvailableOffline, + IsBusinessProcessEnabled, + IsChildEntity, + IsConnectionsEnabled, + IsCustomEntity, + IsCustomizable, + IsDocumentManagementEnabled, + IsDuplicateDetectionEnabled, + IsEnabledForCharts, + IsImportable, + IsIntersect, + IsMailMergeEnabled, + IsManaged, + IsMappable, + IsQuickCreateEnabled, + IsReadingPaneEnabled, + IsRenameable, + IsValidForAdvancedFind, + IsValidForQueue, + IsVisibleInMobile, + IsVisibleInMobileClient, + LogicalName, + ManyToManyRelationships, + ManyToOneRelationships, + MetadataId, + ObjectTypeCode, + OneToManyRelationships, + OwnershipType, + PrimaryIdAttribute, + PrimaryImageAttribute, + PrimaryNameAttribute, + Privileges, + RecurrenceBaseEntityLogicalName, + ReportViewName, + SchemaName, + } + + export enum SearchableEntityMetadataProperties + { + ActivityTypeMask, + AutoCreateAccessTeams, + AutoRouteToOwnerQueue, + CanBeInManyToMany, + CanBePrimaryEntityInRelationship, + CanBeRelatedEntityInRelationship, + CanCreateAttributes, + CanCreateCharts, + CanCreateForms, + CanCreateViews, + CanModifyAdditionalSettings, + CanTriggerWorkflow, + IconLargeName, + IconMediumName, + IconSmallName, + IntroducedVersion, + IsActivity, + IsActivityParty, + IsAIRUpdated, + IsAuditEnabled, + IsAvailableOffline, + IsBusinessProcessEnabled, + IsChildEntity, + IsConnectionsEnabled, + IsCustomEntity, + IsCustomizable, + IsDocumentManagementEnabled, + IsDuplicateDetectionEnabled, + IsEnabledForCharts, + IsImportable, + IsIntersect, + IsMailMergeEnabled, + IsManaged, + IsMappable, + IsQuickCreateEnabled, + IsReadingPaneEnabled, + IsRenameable, + IsValidForAdvancedFind, + IsValidForQueue, + IsVisibleInMobile, + IsVisibleInMobileClient, + LogicalName, + MetadataId, + ObjectTypeCode, + OwnershipType, + PrimaryIdAttribute, + PrimaryImageAttribute, + PrimaryNameAttribute, + RecurrenceBaseEntityLogicalName, + ReportViewName, + SchemaName, + } + + export enum SearchableAttributeMetadataProperties + { + AttributeOf, + AttributeType, + CalculationOf, + CanBeSecuredForCreate, + CanBeSecuredForRead, + CanBeSecuredForUpdate, + CanModifyAdditionalSettings, + ColumnNumber, + DefaultFormValue, + DefaultValue, + DeprecatedVersion, + EntityLogicalName, + Format, + FormatName, + ImeMode, + IntroducedVersion, + IsAuditEnabled, + IsCustomAttribute, + IsCustomizable, + IsManaged, + IsPrimaryId, + IsPrimaryName, + IsRenameable, + IsSecured, + IsValidForAdvancedFind, + IsValidForCreate, + IsValidForRead, + IsValidForUpdate, + LinkedAttributeId, + LogicalName, + MaxLength, + MaxValue, + MetadataId, + MinValue, + Precision, + PrecisionSource, + RequiredLevel, + SchemaName, + YomiOf, + } + + export enum SearchableRelationshipMetadataProperties + { + HasChanged, + Entity1IntersectAttribute, + Entity1LogicalName, + Entity2IntersectAttribute, + Entity2LogicalName, + IntersectEntityName, + IsCustomizable, + IntroducedVersion, + IsCustomRelationship, + IsManaged, + IsValidForAdvancedFind, + MetadataId, + ReferencedAttribute, + ReferencedEntity, + ReferencingAttribute, + ReferencingEntity, + RelationshipType, + SchemaName, + SecurityTypes, + } + + export enum MetadataConditionOperator + { + Equals, + NotEquals, + In, + NotIn, + GreaterThan, + LessThan, + } + + export interface IEntityMetadata + { + ActivityTypeMask; + Attributes: Array; + AutoCreateAccessTeams; + AutoRouteToOwnerQueue: boolean; + CanBeInManyToMany; + CanBePrimaryEntityInRelationship; + CanBeRelatedEntityInRelationship; + CanCreateAttributes; + CanCreateCharts; + CanCreateForms; + CanCreateViews; + CanModifyAdditionalSettings; + CanTriggerWorkflow: boolean; + Description; + DisplayCollectionName; + DisplayName; + IconLargeName; + IconMediumName; + IconSmallName; + IntroducedVersion; + IsActivity: boolean; + IsActivityParty: boolean; + IsAIRUpdated; + IsAuditEnabled; + IsAvailableOffline: boolean; + IsBusinessProcessEnabled; + IsChildEntity: boolean; + IsConnectionsEnabled; + IsCustomEntity: boolean; + IsCustomizable; + IsDocumentManagementEnabled: boolean; + IsDuplicateDetectionEnabled; + IsEnabledForCharts: boolean; + IsImportable: boolean; + IsIntersect: boolean; + IsMailMergeEnabled: boolean; + IsManaged: boolean; + IsMappable: boolean; + IsQuickCreateEnabled: boolean; + IsReadingPaneEnabled: boolean; + IsRenameable: boolean; + IsValidForAdvancedFind: boolean; + IsValidForQueue: boolean; + IsVisibleInMobile: boolean; + IsVisibleInMobileClient: boolean; + LogicalName: string; + ManyToManyRelationships; + ManyToOneRelationships; + MetadataId; + ObjectTypeCode: number; + OneToManyRelationships; + OwnershipType: string; + PrimaryIdAttribute: string; + PrimaryImageAttribute; + PrimaryNameAttribute: string; + Privileges; + RecurrenceBaseEntityLogicalName; + ReportViewName: string; + SchemaName: string; + } + + export interface IAttributeMetadata + { + AttributeOf; + AttributeType; + AttributeTypeName; + CalculationOf; + CanBeSecuredForCreate; + CanBeSecuredForRead; + CanBeSecuredForUpdate; + CanModifyAdditionalSettings; + ColumnNumber; + DefaultFormValue; + DefaultValue; + DeprecatedVersion; + Description; + DisplayName; + EntityLogicalName; + Format; + FormatName; + ImeMode; + IntroducedVersion; + IsAuditEnabled; + IsCustomAttribute; + IsCustomizable; + IsManaged; + IsPrimaryId; + IsPrimaryName; + IsRenameable; + IsSecured; + IsValidForAdvancedFind; + IsValidForCreate; + IsValidForRead; + IsValidForUpdate; + LinkedAttributeId; + LogicalName; + MaxLength; + MaxValue; + MetadataId; + MinValue; + OptionSet; + Precision; + PrecisionSource; + RequiredLevel; + SchemaName; + Targets: string[]; + YomiOf; + } +} From 71e95110ac1d5d0bf814074d66943096edb2128a Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:29:16 +0200 Subject: [PATCH 02/11] Added return type to addColumn() --- sdk.soap/sdk.soap.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts index b450fd481e..2c1aa285f9 100644 --- a/sdk.soap/sdk.soap.d.ts +++ b/sdk.soap/sdk.soap.d.ts @@ -67,7 +67,7 @@ declare module Sdk * Adds a column to the collection. * @param column The logical name of the attribute to add. */ - addColumn( column: string ); + addColumn( column: string ): void; /** * Adds a string array of column names. From 7202742943f7d4b2dbf1e2314705c23e33d6a70b Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:35:46 +0200 Subject: [PATCH 03/11] Added missing type annotations --- sdk.soap/sdk.soap.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts index 2c1aa285f9..a6749acf1f 100644 --- a/sdk.soap/sdk.soap.d.ts +++ b/sdk.soap/sdk.soap.d.ts @@ -73,7 +73,7 @@ declare module Sdk * Adds a string array of column names. * @param columns A string array of column names. */ - addColumns( columns: Array ); + addColumns( columns: Array ): void; /** * Sets the AllColumns property. @@ -141,7 +141,7 @@ declare module Sdk * Adds an array of objects to the collection. * @param items An array of items to add to the collection. */ - addRange( items ): void; + addRange( items: T[] ): void; /** * Removes all items from the collection. @@ -158,7 +158,7 @@ declare module Sdk * Applies the action contained within a delegate function. * @param fn Delegate function with parameters for item and index. */ - forEach( fn: ( item: T, index: number ) => any ); + forEach( fn: ( item: T, index: number ) => any ): void; /** * Gets the item in the collection at the specified index. @@ -279,7 +279,7 @@ declare module Sdk * Sets whether the results of the query exceeds the total record count. * @param totalRecordCountLimitExceeded Whether the results of the query exceeds the total record count. */ - setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ); + setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ): void; /** * XML definition of an the child nodes of an entity. @@ -318,7 +318,7 @@ declare module Sdk * Removes an entity reference to the collection. * @param entityReference The entity reference to remove. */ - remove( entityReference: Sdk.EntityReference ); + remove( entityReference: Sdk.EntityReference ): void; /** * Returns a view of the data in an entity reference collection instance. @@ -455,7 +455,7 @@ declare module Sdk /** * Internal Use Only */ - setValidValue( value ); + setValidValue( value: any ): void; /// prototype methods @@ -463,7 +463,7 @@ declare module Sdk /** * XML node for Attribute. */ - toXml( action ): string; + toXml( action: string ): string; } class Boolean extends AttributeBase @@ -750,7 +750,7 @@ declare module Sdk * Sets the collection of attributes for the entity. * @param attributes The collection of attributes for the entity. */ - setAttributes( attributes: Sdk.AttributeCollection ); + setAttributes( attributes: Sdk.AttributeCollection ): void; /** * Gets the state of the entity. @@ -795,7 +795,7 @@ declare module Sdk * Sets the logical name of the entity. * @param type The logical name of the entity. */ - setType( type ): void; + setType( type: string ): void; /** * Gets a collection of related entities. @@ -813,7 +813,7 @@ declare module Sdk * @param attribute The attribute to add * @param isChanged Whether the attribute should be considered changed, the default is true. */ - addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ); + addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ): void; /** * Adds an entity to the related entities. @@ -831,7 +831,7 @@ declare module Sdk * Sets the value to indicate whether data for the entity has changed. * @param isChanged The value to indicate whether data for the entity has changed. */ - setIsChanged( isChanged: boolean ); + setIsChanged( isChanged: boolean ): void; /** * Gets the value of the specified attribute. @@ -842,7 +842,7 @@ declare module Sdk /** * Generates properties for the entity based on metadata. */ - initializeSubClass( metadata ); + initializeSubClass( metadata ): void; /** * Sets the value of the specified attribute. From 29f5682e04a1539c76dbb96d885987969b8f4479 Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:47:02 +0200 Subject: [PATCH 04/11] Added more type definitions --- sdk.soap/sdk.soap.d.ts | 152 ++++++++++++++++++++--------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts index a6749acf1f..df98878026 100644 --- a/sdk.soap/sdk.soap.d.ts +++ b/sdk.soap/sdk.soap.d.ts @@ -79,7 +79,7 @@ declare module Sdk * Sets the AllColumns property. * @params allColumns A boolean value. */ - setAllColumns( allColumns: boolean ); + setAllColumns( allColumns: boolean ): void; /** * Whether all columns will be returned. @@ -309,7 +309,7 @@ declare module Sdk * Sets the collection of entity references. * @param entityReferences The entity references */ - setEntityReferences( entityReferences: Sdk.Collection ); + setEntityReferences( entityReferences: Sdk.Collection ): void; /// prototype methods @@ -842,7 +842,7 @@ declare module Sdk /** * Generates properties for the entity based on metadata. */ - initializeSubClass( metadata ): void; + initializeSubClass( metadata: any ): void; /** * Sets the value of the specified attribute. @@ -2092,38 +2092,38 @@ declare module Sdk.Mdq export interface IEntityMetadata { - ActivityTypeMask; + ActivityTypeMask: any; Attributes: Array; - AutoCreateAccessTeams; + AutoCreateAccessTeams: any; AutoRouteToOwnerQueue: boolean; - CanBeInManyToMany; - CanBePrimaryEntityInRelationship; - CanBeRelatedEntityInRelationship; - CanCreateAttributes; - CanCreateCharts; - CanCreateForms; - CanCreateViews; - CanModifyAdditionalSettings; + CanBeInManyToMany: any; + CanBePrimaryEntityInRelationship: any; + CanBeRelatedEntityInRelationship: any; + CanCreateAttributes: any; + CanCreateCharts: any; + CanCreateForms: any; + CanCreateViews: any; + CanModifyAdditionalSettings: any; CanTriggerWorkflow: boolean; - Description; - DisplayCollectionName; - DisplayName; - IconLargeName; - IconMediumName; - IconSmallName; - IntroducedVersion; + Description: any; + DisplayCollectionName: any; + DisplayName: any; + IconLargeName: any; + IconMediumName: any; + IconSmallName: any; + IntroducedVersion: any; IsActivity: boolean; IsActivityParty: boolean; - IsAIRUpdated; - IsAuditEnabled; + IsAIRUpdated: any; + IsAuditEnabled: any; IsAvailableOffline: boolean; - IsBusinessProcessEnabled; + IsBusinessProcessEnabled: any; IsChildEntity: boolean; - IsConnectionsEnabled; + IsConnectionsEnabled: any; IsCustomEntity: boolean; - IsCustomizable; + IsCustomizable: any; IsDocumentManagementEnabled: boolean; - IsDuplicateDetectionEnabled; + IsDuplicateDetectionEnabled: any; IsEnabledForCharts: boolean; IsImportable: boolean; IsIntersect: boolean; @@ -2138,66 +2138,66 @@ declare module Sdk.Mdq IsVisibleInMobile: boolean; IsVisibleInMobileClient: boolean; LogicalName: string; - ManyToManyRelationships; - ManyToOneRelationships; - MetadataId; + ManyToManyRelationships: any; + ManyToOneRelationships: any; + MetadataId: any; ObjectTypeCode: number; - OneToManyRelationships; + OneToManyRelationships: any; OwnershipType: string; PrimaryIdAttribute: string; - PrimaryImageAttribute; + PrimaryImageAttribute: any; PrimaryNameAttribute: string; - Privileges; - RecurrenceBaseEntityLogicalName; + Privileges: any; + RecurrenceBaseEntityLogicalName: any; ReportViewName: string; SchemaName: string; } export interface IAttributeMetadata { - AttributeOf; - AttributeType; - AttributeTypeName; - CalculationOf; - CanBeSecuredForCreate; - CanBeSecuredForRead; - CanBeSecuredForUpdate; - CanModifyAdditionalSettings; - ColumnNumber; - DefaultFormValue; - DefaultValue; - DeprecatedVersion; - Description; - DisplayName; - EntityLogicalName; - Format; - FormatName; - ImeMode; - IntroducedVersion; - IsAuditEnabled; - IsCustomAttribute; - IsCustomizable; - IsManaged; - IsPrimaryId; - IsPrimaryName; - IsRenameable; - IsSecured; - IsValidForAdvancedFind; - IsValidForCreate; - IsValidForRead; - IsValidForUpdate; - LinkedAttributeId; - LogicalName; - MaxLength; - MaxValue; - MetadataId; - MinValue; - OptionSet; - Precision; - PrecisionSource; - RequiredLevel; - SchemaName; + AttributeOf: any; + AttributeType: any; + AttributeTypeName: any; + CalculationOf: any; + CanBeSecuredForCreate: any; + CanBeSecuredForRead: any; + CanBeSecuredForUpdate: any; + CanModifyAdditionalSettings: any; + ColumnNumber: any; + DefaultFormValue: any; + DefaultValue: any; + DeprecatedVersion: any; + Description: any; + DisplayName: any; + EntityLogicalName: any; + Format: any; + FormatName: any; + ImeMode: any; + IntroducedVersion: any; + IsAuditEnabled: any; + IsCustomAttribute: any; + IsCustomizable: any; + IsManaged: any; + IsPrimaryId: any; + IsPrimaryName: any; + IsRenameable: any; + IsSecured: any; + IsValidForAdvancedFind: any; + IsValidForCreate: any; + IsValidForRead: any; + IsValidForUpdate: any; + LinkedAttributeId: any; + LogicalName: any; + MaxLength: any; + MaxValue: any; + MetadataId: any; + MinValue: any; + OptionSet: any; + Precision: any; + PrecisionSource: any; + RequiredLevel: any; + SchemaName: any; Targets: string[]; - YomiOf; + YomiOf: any; } } From 53694285198106f1404b19df5832d44e1fbf5b55 Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 14:28:59 +0100 Subject: [PATCH 05/11] Rename => naming convention --- {sdk.soap => microsoft-sdk-soap}/sdk.soap-tests.ts | 0 {sdk.soap => microsoft-sdk-soap}/sdk.soap.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {sdk.soap => microsoft-sdk-soap}/sdk.soap-tests.ts (100%) rename {sdk.soap => microsoft-sdk-soap}/sdk.soap.d.ts (100%) diff --git a/sdk.soap/sdk.soap-tests.ts b/microsoft-sdk-soap/sdk.soap-tests.ts similarity index 100% rename from sdk.soap/sdk.soap-tests.ts rename to microsoft-sdk-soap/sdk.soap-tests.ts diff --git a/sdk.soap/sdk.soap.d.ts b/microsoft-sdk-soap/sdk.soap.d.ts similarity index 100% rename from sdk.soap/sdk.soap.d.ts rename to microsoft-sdk-soap/sdk.soap.d.ts From 3ba7db269cfcfa63b2eeedae0443f57372ca7203 Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 14:29:57 +0100 Subject: [PATCH 06/11] Rename => naming convention --- .../{sdk.soap-tests.ts => microsoft-sdk-soap-tests.ts} | 0 microsoft-sdk-soap/{sdk.soap.d.ts => microsoft-sdk-soap.ts} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename microsoft-sdk-soap/{sdk.soap-tests.ts => microsoft-sdk-soap-tests.ts} (100%) rename microsoft-sdk-soap/{sdk.soap.d.ts => microsoft-sdk-soap.ts} (100%) diff --git a/microsoft-sdk-soap/sdk.soap-tests.ts b/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts similarity index 100% rename from microsoft-sdk-soap/sdk.soap-tests.ts rename to microsoft-sdk-soap/microsoft-sdk-soap-tests.ts diff --git a/microsoft-sdk-soap/sdk.soap.d.ts b/microsoft-sdk-soap/microsoft-sdk-soap.ts similarity index 100% rename from microsoft-sdk-soap/sdk.soap.d.ts rename to microsoft-sdk-soap/microsoft-sdk-soap.ts From dc0c9e43b8b9265ef20d89dbc603b28f82ce4110 Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 14:47:13 +0100 Subject: [PATCH 07/11] Much more typings --- microsoft-sdk-soap/microsoft-sdk-soap.ts | 1635 +++++++++++++++------- 1 file changed, 1151 insertions(+), 484 deletions(-) diff --git a/microsoft-sdk-soap/microsoft-sdk-soap.ts b/microsoft-sdk-soap/microsoft-sdk-soap.ts index df98878026..f70de774ac 100644 --- a/microsoft-sdk-soap/microsoft-sdk-soap.ts +++ b/microsoft-sdk-soap/microsoft-sdk-soap.ts @@ -5,6 +5,7 @@ /// + declare module Sdk { interface IEntityView @@ -35,7 +36,79 @@ declare module Sdk } interface IEntityReferenceCollectionView extends Array - { } + { + } + + class Q + { + /** + * Creates a link between records. + * @param entityName The logical name of the entity that is specified in the entityId parameter. + * @param entityId The ID of the record to which the related records are associated. + * @param relationship The name of the relationship to be used to create the link. + * @param relatedEntities A collection of Sdk.EntityReference objects to be associated. + */ + static associate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + /** + * Creates an entity record and returns a string representation of the GUID value that is the Id of the created entity. + * @param entity An entity instance. + */ + static create( entity: Sdk.Entity ): Q.Promise; + + /** + * Deletes an entity record + * @param entityName The LogicalName of the entity to delete. + * @param id An ID of the record to delete. + */ + static del( entityName: string, id: string ): Q.Promise; + + /** + * Removes a link between records. + * @param entityName The logical name of the entity that is specified in the entityId parameter. + * @param entityId The ID of the record to which the related records are disassociated. + * @param relationship The name of the relationship to be used to remove the link. + * @param relatedEntities A collection of Sdk.EntityReference objects to be disassociated. + */ + static disassociate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + + /** + * Executes a SOAP Request using the SOAPAction Execute. + * @param request A request object. + */ + static execute( request: Sdk.OrganizationRequest ): Q.Promise; + + /** + * Retrieves an entity instance. + * @param entityName The logical name of the entity to retrieve. + * @param id The id of the entity to retrieve. + * @param columnSet The columns of the entities to retrieve. + */ + static retrieve( entityName: string, id: string, columnSet: Sdk.ColumnSet ): Q.Promise; + + /** + * Retrieves the results of a query + * @param query An Sdk.Query.QueryByAttribute query. + */ + static retrieveMultiple( query: Sdk.Query.QueryByAttribute ): Q.Promise; + + /** + * Retrieves the results of a query + * @param query An Sdk.Query.QueryExpression query. + */ + static retrieveMultiple( query: Sdk.Query.QueryExpression ): Q.Promise; + + /** + * Retrieves the results of a query + * @param query An Sdk.Query.FetchExpression query. + */ + static retrieveMultiple( query: Sdk.Query.FetchExpression ): Q.Promise; + + /** + * Updates an entity instance. + * @param entity An entity instance to update. + */ + static update( entity: Entity ): Q.Promise; + } class ColumnSet { @@ -47,7 +120,7 @@ declare module Sdk /** * Specifies the attributes for which non- null values are returned from a query. - * @param columns An Array of string values. + * @param columns An array of string values. */ constructor( columns: string[] ); @@ -67,19 +140,19 @@ declare module Sdk * Adds a column to the collection. * @param column The logical name of the attribute to add. */ - addColumn( column: string ): void; + addColumn( column: string ); /** * Adds a string array of column names. * @param columns A string array of column names. */ - addColumns( columns: Array ): void; + addColumns( columns: Array ); /** * Sets the AllColumns property. * @params allColumns A boolean value. */ - setAllColumns( allColumns: boolean ): void; + setAllColumns( allColumns: boolean ); /** * Whether all columns will be returned. @@ -114,7 +187,6 @@ declare module Sdk class ValueType { - } class Collection @@ -141,7 +213,7 @@ declare module Sdk * Adds an array of objects to the collection. * @param items An array of items to add to the collection. */ - addRange( items: T[] ): void; + addRange( items ): void; /** * Removes all items from the collection. @@ -154,11 +226,23 @@ declare module Sdk */ contains( item: T ): boolean; + /** + * Returns whether an object exists within the collection. + * @param predicate A comparer function which is invoked for each item of the collection. + */ + contains( predicate: ( item: T ) => boolean ): boolean; + + /** + * Returns an Sdk.Collection that contains all the items of this collection that satisfy the specified predicate function. + * @param predicate A predicate function that takes a collection item as argument and returns a boolean. + */ + select( predicate: ( item: T ) => boolean ): Collection; + /** * Applies the action contained within a delegate function. * @param fn Delegate function with parameters for item and index. */ - forEach( fn: ( item: T, index: number ) => any ): void; + forEach( fn: ( item: T, index: number ) => any ); /** * Gets the item in the collection at the specified index. @@ -168,7 +252,7 @@ declare module Sdk /** * Removes an item from the collection. - * @param item The item to be removed. + * @param item A reference to the item to be removed. */ remove( item: T ): void; @@ -204,16 +288,29 @@ declare module Sdk /** * Gets an entity in the collection. - * @param indexOrId The index or Id of the entity in the collection. + * @param index The index of the entity in the collection. */ - getEntity( indexOrId: string | Sdk.Guid ): Sdk.Entity; + getEntity( index: number ): Sdk.Entity; + + /** + * Gets an entity in the collection. + * @param id The id of the entity in the collection. + */ + getEntity( id: Sdk.Guid ): Sdk.Entity; /** * Sets an item in the collection. - * @param indexOrId The index or Sdk.Guid id of the entity in the collection. + * @param index The index of the entity in the collection. * @param value The Sdk.Entity value to set. */ - setEntity( indexOrId: string | Sdk.Guid, value: Sdk.Entity ): void; + setEntity( index: number, value: Sdk.Entity ): void; + + /** + * Sets an item in the collection. + * @param id The Sdk.Guid id of the entity in the collection. + * @param value The Sdk.Entity value to set. + */ + setEntity( id: Sdk.Guid, value: Sdk.Entity ): void; /** * Gets the logical name of the entity. @@ -279,7 +376,7 @@ declare module Sdk * Sets whether the results of the query exceeds the total record count. * @param totalRecordCountLimitExceeded Whether the results of the query exceeds the total record count. */ - setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ): void; + setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ); /** * XML definition of an the child nodes of an entity. @@ -309,7 +406,7 @@ declare module Sdk * Sets the collection of entity references. * @param entityReferences The entity references */ - setEntityReferences( entityReferences: Sdk.Collection ): void; + setEntityReferences( entityReferences: Sdk.Collection ); /// prototype methods @@ -318,7 +415,7 @@ declare module Sdk * Removes an entity reference to the collection. * @param entityReference The entity reference to remove. */ - remove( entityReference: Sdk.EntityReference ): void; + remove( entityReference: Sdk.EntityReference ); /** * Returns a view of the data in an entity reference collection instance. @@ -333,11 +430,12 @@ declare module Sdk class RelatedEntityCollection extends EntityCollection { - } class AttributeCollection extends Collection { + constructor(); + /** * Adds an attribute to the Attribute Collection. * @param attribute The attribute to add. @@ -455,15 +553,21 @@ declare module Sdk /** * Internal Use Only */ - setValidValue( value: any ): void; + setValidValue( value ); + /** + * Sets the general value of the attribute + * @param name The value of the attribute. + */ + setValue( value: any ); /// prototype methods - /** * XML node for Attribute. */ - toXml( action: string ): string; + toXml( action ): string; + + } class Boolean extends AttributeBase @@ -719,7 +823,8 @@ declare module Sdk } class EntityState - { } + { + } class Entity { @@ -738,19 +843,31 @@ declare module Sdk * Gets the collection of attributes for the entity. * @param attributeName The attribute with matching name is returned. */ - getAttributes( attributeName: string ): Sdk.AttributeCollection; + getAttributes( attributeName: string ): Sdk.AttributeBase; /** * Gets the collection of attributes for the entity. * @param index The attribute with matching index is returned. */ - getAttributes( index: number ): Sdk.AttributeCollection; + getAttributes( index: number ): Sdk.AttributeBase; + + /** + * Checks whether the entity has an attribute that satisfies the specified predicate. + * @param A comparer function that takes an Sdk.AttributeBase as argument and returns a boolean. + */ + containsAttribute( predicate: ( attribute: Sdk.AttributeBase ) => boolean ): boolean; + + /** + * Checks whether the entity has an attribute with the specified name. + * @param The name of the attribute. + */ + containsAttribute( name: string ): boolean; /** * Sets the collection of attributes for the entity. * @param attributes The collection of attributes for the entity. */ - setAttributes( attributes: Sdk.AttributeCollection ): void; + setAttributes( attributes: Sdk.AttributeCollection ); /** * Gets the state of the entity. @@ -795,7 +912,7 @@ declare module Sdk * Sets the logical name of the entity. * @param type The logical name of the entity. */ - setType( type: string ): void; + setType( type ): void; /** * Gets a collection of related entities. @@ -813,7 +930,7 @@ declare module Sdk * @param attribute The attribute to add * @param isChanged Whether the attribute should be considered changed, the default is true. */ - addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ): void; + addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ); /** * Adds an entity to the related entities. @@ -831,18 +948,18 @@ declare module Sdk * Sets the value to indicate whether data for the entity has changed. * @param isChanged The value to indicate whether data for the entity has changed. */ - setIsChanged( isChanged: boolean ): void; + setIsChanged( isChanged: boolean ); /** * Gets the value of the specified attribute. * @param logicalName The logical name of the attribute. */ - getValue( logicalName: string ): Object; + getValue( logicalName: string ): any; /** * Generates properties for the entity based on metadata. */ - initializeSubClass( metadata: any ): void; + initializeSubClass( metadata ); /** * Sets the value of the specified attribute. @@ -941,75 +1058,39 @@ declare module Sdk } class OrganizationRequest - { } - - class OrganizationResponse - { } - - class Q { /** - * Creates a link between records. - * @param entityName The logical name of the entity that is specified in the entityId parameter. - * @param entityId The ID of the record to which the related records are associated. - * @param relationship The name of the relationship to be used to create the link. - * @param relatedEntities A collection of Sdk.EntityReference objects to be associated. + * Sets the request XML. + * @param xml The request XML. */ - static associate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + setRequestXml( xml: string ): void; + /** - * Creates an entity record and returns a string representation of the GUID value that is the Id of the created entity. - * @param entity An entity instance. + * Gets the request XML. */ - static create( entity: Sdk.Entity ): Q.Promise; + getRequestXml(): string; + + /** + * Sets the response type. + * @param type A class that inherits from Sdk.OrganizationResponse. + */ + setResponseType( type: OrganizationResponse ): void; /** - * Deletes an entity record - * @param entityName The LogicalName of the entity to delete. - * @param id An ID of the record to delete. + * Gets the response type. */ - static del( entityName: string, id: string ): Q.Promise; + getResponseType(): OrganizationResponse; + } - /** - * Removes a link between records. - * @param entityName The logical name of the entity that is specified in the entityId parameter. - * @param entityId The ID of the record to which the related records are disassociated. - * @param relationship The name of the relationship to be used to remove the link. - * @param relatedEntities A collection of Sdk.EntityReference objects to be disassociated. - */ - static disassociate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; - - /** - * Executes a SOAP Request using the SOAPAction Execute. - * @param request A request object. - */ - static execute( request: Sdk.OrganizationRequest ): Q.Promise; - - /** - * Retrieves an entity instance. - * @param entityName The logical name of the entity to retrieve. - * @param id The id of the entity to retrieve. - * @param columnSet The columns of the entities to retrieve. - */ - static retrieve( entityName: string, id: string, columnSet: Sdk.ColumnSet ): Q.Promise; - - /** - * Retrieves the results of a query - * @param query Either an Sdk.Query.FetchExpression or Sdk.Query.QueryExpression query - */ - static retrieveMultiple( query: Query.QueryBase ): Q.Promise; - - /** - * Updates an entity instance. - * @param entity An entity instance to update. - */ - static update( entity: Entity ): Q.Promise; + class OrganizationResponse + { } /** * Contains the data that is needed to convert a query in FetchXML to a QueryExpression. * @param fetchXml Sets the query to convert. */ - class FetchXmlToQueryExpressionRequest + class FetchXmlToQueryExpressionRequest extends Sdk.OrganizationRequest { constructor( fetchXml: string ); @@ -1024,7 +1105,7 @@ declare module Sdk * Response to FetchXmlToQueryExpressionRequest. * @param responseXml The response XML to the FetchXmlToQueryExpressionRequest. */ - class FetchXmlToQueryExpressionResponse + class FetchXmlToQueryExpressionResponse extends Sdk.OrganizationResponse { constructor( responseXml: string ); @@ -1034,98 +1115,109 @@ declare module Sdk public getQuery(): Query.QueryExpression; } - -} - -declare module Sdk.Mdq.ValueEnums -{ - export enum OwnershipType + /** + * Contains the data that is needed to convert a query, which is represented as a QueryExpression class, to its equivalent query, which is represented as FetchXML. + * @param query The query. + */ + class QueryExpressionToFetchXmlRequest extends Sdk.OrganizationRequest { - None, - OrganizationOwned, - TeamOwned, - UserOwned, + constructor( query: Sdk.Query.QueryBase ); + + /** + * Sets the query to convert. + * @param query The query. + * @param query + */ + public setQuery( query: Sdk.Query.QueryBase ): void; } - export enum AttributeTypeCode + /** + * Response to QueryExpressionToFetchXmlRequest. + */ + class QueryExpressionToFetchXmlResponse extends Sdk.OrganizationResponse { - BigInt, - Boolean, - CalendarRules, - Customer, - DateTime, - Decimal, - Double, - EntityName, - Integer, - Lookup, - ManagedProperty, - Memo, - Money, - Owner, - PartyList, - Picklist, - State, - Status, - String, - Uniqueidentifier, - Virtual, + constructor( responseXml: string ); + + /** + * Gets the results of the query conversion. + */ + public getFetchXml(): string; + } + + /** + * Request to retrieve metadata and metadata changes. + * @param query The Sdk.Mdq.EntityQueryExpression that defines the query. + * @param clientVersionStamp The Sdk.Mdq.RetrieveMetadataChangesResponse.ServerVersionStamp value from a previous request. When included only the metadata changes since the previous request will be returned. + * @param deletedMetadataFilters An Sdk.Mdq.DeletedMetadataFilters enumeration value. When included the deleted metadata changes will be limited to the types defined by the enumeration. + */ + class RetrieveMetadataChangesRequest extends Sdk.OrganizationRequest + { + constructor( query: Sdk.Mdq.EntityQueryExpression, clientVersionStamp?: string, deletedMetadataFilters?: Sdk.Mdq.DeletedMetadataFilters ); + getEntityMetadata(): Sdk.Mdq.IEntityMetadata[]; + getServerVersionStamp(): string; + getDeletedMetadata(): Object; + } + + /** + * Response to RetrieveMetadataChangesRequest. + * @param resopnseXml The response XML. + */ + class RetrieveMetadataChangesResponse + { + constructor( responseXml: string ); + + /*** + * + */ + public getEntityMetadata(): Array; + + /*** + * + */ + public getServerVersionStamp(); + + /*** + * + */ + public getDeletedMetadata(); + } + + + /** + * Contains the data that is needed to set the state of an entity record. + * @param entityMoniker Sets the entity. + * @param state Sets the state of the entity record. + * @param status Sets the status that corresponds to the State property. + */ + class SetStateRequest extends Sdk.OrganizationRequest + { + constructor( entityMoniker: EntityReference, state: number, status: number ); + + /** + * Sets the entity. + * @param value The entity. + */ + public setEntityMoniker( value: EntityReference ): void; + + /** + * Sets the state of the entity record. + * @param value The state of the entity record. + */ + setState( value: number ): void; + + /** + * Sets the status that corresponds to the State property. + * @param value: number The status that corresponds to the State property. + */ + setStatus( value ): void; } - - export enum AttributeRequiredLevel + /** + * Response to SetStateRequest. + */ + class SetStateResponse { - ApplicationRequired, - None, - Recommended, - SystemRequired, - } - - - export enum DateTimeFormat - { - DateAndTime, - DateOnly, - } - - export enum ImeMode - { - Active, - Auto, - Disabled, - Inactive, - } - - - - export enum IntegerFormat - { - Duration, - Language, - Locale, - None, - TimeZone, - } - - - export enum SecurityTypes - { - Append, - Inheritance, - None, - ParentChild, - Pointer, - } - - export enum StringFormat - { - Email, - PhoneticGuide, - Text, - TextArea, - TickerSymbol, - Url, - VersionNumber, + constructor( responseXml: string ); } } @@ -1139,21 +1231,6 @@ declare module Sdk.Query */ constructor( type: string ); - /** - * - */ - getQueryType(): string; - } - - class QueryByAttribute extends QueryBase - { - /** - * Initializes a new instance of the QueryByAttribute class setting the entity name. - * @param entityName The logical name of the entity. - * - */ - constructor( entityName: string ); - /** * Gets the columns to include. */ @@ -1167,7 +1244,7 @@ declare module Sdk.Query /** * Sets the columns to include. - * @param columns An Array of attribute logical names for the columns to return. + * @param columns An array of attribute logical names for the columns to return. */ setColumnSet( columns: Array ): void; @@ -1177,6 +1254,11 @@ declare module Sdk.Query */ setColumnSet( ...columns: string[] ): void; + /** + * + */ + getQueryType(): string; + /** * Gets the logical name of the entity. */ @@ -1184,25 +1266,9 @@ declare module Sdk.Query /** * Sets the logical name of the entity. - * @param name The logical name of the entity + * @param name The logical name of the entity. */ - setEntityName( name: string ); - - /** - * Gets An Sdk.Collection of Sdk.AttributeBase attributes. - */ - getAttributeValues(): Sdk.Collection; - - /** - * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. - */ - getOrders(): Sdk.Collection; - - /** - * Sets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. - * @param orders An Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. - */ - setOrders( orders: Sdk.Collection ); + setEntityName( name: string ): void; /** * Gets the number of pages and the number of entity instances per page returned from the query. @@ -1215,6 +1281,24 @@ declare module Sdk.Query */ setPageInfo( pageInfo: Sdk.Query.PagingInfo ); + /** + * Adds the specified column to the column set. + * @param columnName The logical name of the column to add. + */ + addColumn( columnName: string ): void; + + /** + * Removes a column from the ColumnSet used by the query. + * @param columnName The logical name of an attribute to be removed from the ColumnSet. + * @param errorIfNotFound Whether to throw an error when the column to remove is not found. The default is false. + */ + removeColumn( columnName: string, errorIfNotFound?: boolean ): void; + + /** + * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + getOrders(): Sdk.Collection; + /** * Gets the number of rows to be returned. */ @@ -1225,7 +1309,37 @@ declare module Sdk.Query * @param count The number of rows to be returned. */ setTopCount( count: number ); + + /** + * Gets the serialized QueryExpression. + */ + toXml(): string; + + /** + * Gets the serialized QueryExpression values. + */ + toValueXml(): string; + } + + class QueryByAttribute extends QueryBase + { + /** + * Initializes a new instance of the QueryByAttribute class setting the entity name. + * @param entityName The logical name of the entity. + * + */ + constructor( entityName: string ); + /** + * Gets An Sdk.Collection of Sdk.AttributeBase attributes. + */ + getAttributeValues(): Sdk.Collection; + + /** + * Sets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + * @param orders An Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + setOrders( orders: Sdk.Collection ); /// prototype methods @@ -1235,12 +1349,6 @@ declare module Sdk.Query */ addAttributeValue( attributeValue: Sdk.AttributeBase ): void; - /** - * Adds a column to the ColumnSet used by the query. - * @param columnName The logical name of an attribute to be returned by the query. - */ - addColumn( columnName: string ): void; - /** * Adds an order to apply to the results of the query. * @param order An order expression. @@ -1253,23 +1361,6 @@ declare module Sdk.Query * @param errorIfNotFound Whether to throw an error when the attribute to remove is not found. The default is false. */ removeAttributeValue( attributeValue: Sdk.AttributeBase, errorIfNotFound?: boolean ): void; - - /** - * Removes a column from the ColumnSet used by the query. - * @param columnName The logical name of an attribute to be removed from the ColumnSet. - * @param errorIfNotFound Whether to throw an error when the column to remove is not found. The default is false. - */ - removeColumn( columnName: string, errorIfNotFound?: boolean ): void; - - /** - * Gets the serialized QueryByAttribute. - */ - toXml(): string; - - /** - * Gets the serialized QueryByAttribute values. - */ - toValueXml(): string; } class QueryExpression extends QueryBase @@ -1280,33 +1371,10 @@ declare module Sdk.Query */ constructor( entityName: string ); - /** - * Gets the columns to include. - */ - getColumnSet(): Sdk.ColumnSet; - - /** - * Sets the columns to include. - * @param columns An Sdk.ColumnSet instance. - */ - setColumnSet( columns: Sdk.ColumnSet ): void; - - /** - * Sets the columns to include. - * @param columns An Array of attribute logical names for the columns to return. - */ - setColumnSet( columns: Array ): void; - - /** - * Sets the columns to include. - * @param columns Pass each attribute logical name as an argument. - */ - setColumnSet( ...columns: string[] ): void; - /** * Gets the complex condition and logical filter expressions that filter the results of the query. */ - getCriteria: FilterExpression; + getCriteria(): FilterExpression; /** * Sets the complex condition and logical filter expressions that filter the results of the query. @@ -1324,21 +1392,10 @@ declare module Sdk.Query */ setDistinct( isDistinct: boolean ); - /** - * Gets the logical name of the entity. - */ - getEntityName(): string; - - /** - * Sets the logical name of the entity. - * @param name The logical name of the entity. - */ - setEntityName( name: string ): void; - /** * Gets an Sdk.Collection of Sdk.Query.LinkEntity instances. */ - getLinkEntities(): LinkEntity; + getLinkEntities(): Sdk.Collection; /** * Gets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query. @@ -1351,42 +1408,8 @@ declare module Sdk.Query */ setNoLock( isNoLock: boolean ): void; - /** - * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. - */ - getOrders(): OrderExpression; - - /** - * Gets the number of pages and the number of entity instances per page returned from the query. - */ - getPageInfo(): PagingInfo; - - /** - * Sets the number of pages and the number of entity instances per page returned from the query. - * @param pageInfo The number of pages and the number of entity instances per page returned from the query. - */ - setPageInfo( pageInfo: PagingInfo ): void; - - /** - * Gets the number of rows to be returned. - */ - getTopCount(): number; - - /** - * Sets the number of rows to be returned. - * @param topCount The number of rows to be returned. - */ - setTopCount( topCount: number ): void; - - /// prototype methods - /** - * Adds the specified column to the column set. - * @param columnName The logical name of the column to add. - */ - addColumn( columnName: string ): void; - /** * Contains a condition expression used to filter the results of the query. * @param entityName The logical name of the entity in the condition expression. @@ -1429,28 +1452,333 @@ declare module Sdk.Query * @param orderType The order, ascending or descending. Ascending is the default if not specified. */ addOrder( attributeName: string, orderType: Sdk.Query.OrderType ): void; - - /** - * Gets the serialized QueryExpression. - */ - toXml(): string; - - /** - * Gets the serialized QueryExpression values. - */ - toValueXml(): string; } class OrderExpression { } + class ConditionExpression + { + /** + * Contains a condition expression used to filter the results of the query. + * @param name entityName The logical name of the entity in the condition expression. + * @param name attributeName The logical name of the attribute in the condition expression. + * @param name operator The condition operator. + * @param name values The value(s) to compare. + * Use one of the following classes that inherit from Sdk.Query.ValueBase: + * - Sdk.Query.Booleans + * - Sdk.Query.BooleanManagedProperties + * - Sdk.Query.Dates + * - Sdk.Query.Decimals + * - Sdk.Query.Doubles + * - Sdk.Query.EntityReferences + * - Sdk.Query.Guids + * - Sdk.Query.Ints + * - Sdk.Query.Longs + * - Sdk.Query.Money + * - Sdk.Query.OptionSets + * - Sdk.Query.Strings + */ + constructor( entityName: string, attributeName: string, operator: ConditionOperator, values?: ValueBase ); + + /** + * Returns the logical name of the entity in the condition expression. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity in the condition expression. + * @param name The logical name of the entity in the condition expression. + */ + setEntityName( name: string ): void; + + /** + * Returns the logical name of the attribute in the condition expression. + */ + getAttributeName(): string; + + /** + * Sets the logical name of the attribute in the condition expression. + * @param name The logical name of the attribute in the condition expression. + */ + setAttributeName( name: string ): void; + + /** + * Returns the condition operator. + */ + getOperator(): ConditionOperator; + + /** + * Sets the condition operator. + * @param operator The condition operator. + */ + setOperator( operator: ConditionOperator ): void; + + /** + * Returns the values for the attribute. + */ + getValues(): ValueBase; + + /** + * Sets the values for the attribute. + * @param The value(s) to compare + * Use one of the following classes that inherit from Sdk.Query.ValueBase: + * - Sdk.Query.Booleans + * - Sdk.Query.BooleanManagedProperties + * - Sdk.Query.Dates + * - Sdk.Query.Decimals + * - Sdk.Query.Doubles + * - Sdk.Query.EntityReferences + * - Sdk.Query.Guids + * - Sdk.Query.Ints + * - Sdk.Query.Longs + * - Sdk.Query.Money + * - Sdk.Query.OptionSets + * - Sdk.Query.Strings + */ + setValues( values: ValueBase ): void; + } + + /** + * Specifies complex condition and logical filter expressions used for filtering the results of the query. + * @param logicalOperator The filter operator. + */ class FilterExpression { + constructor( logicalOperator: LogicalOperator ); + + /** + * Adds a condition to the filter expression setting the attribute name, condition operator, and values. + * @param conditionExpression The expression that will set the condition. + */ + public addCondition( firstParam: ConditionExpression ): void; + + /** + * Adds a condition to the filter expression setting the attribute name, condition operator, and values. + * @param entityName The entityName of the new ConditionExpression that will be instantiated using the other parameters. + * @param attributeName The attribute name to use in the condition expression. + * @param conditionOperator The condition operator if the first parameter is a string. + * @param values The value(s) to compare. + * Use one of the following classes that + * - Sdk.Query.Booleans + * - Sdk.Query.BooleanManagedProperties + * - Sdk.Query.Dates + * - Sdk.Query.Decimals + * - Sdk.Query.Doubles + * - Sdk.Query.EntityReferences + * - Sdk.Query.Guids + * - Sdk.Query.Ints + * - Sdk.Query.Longs + * - Sdk.Query.Money + * - Sdk.Query.OptionSets + * - Sdk.Query.Strings + */ + public addCondition( entityName: string, attributeName: string, conditionOperator: ConditionOperator, values?: ValueBase ): void; + + /** + * Adds a child filter to the filter expression. + * @param filterExpression The filter to add. + */ + addFilter( filterExpression: FilterExpression ): void; + + /** + * Adds a child filter to the filter expression. + * @param logicalOperator Creates new FilterExpression with the specified logical operator and adds it. + */ + addFilter( logicalOperator: LogicalOperator ): void; + + /** + * Returns a collection of Sdk.Query.ConditionExpression values. + */ + getConditions(): Sdk.Collection; + + /** + * Gets the logical AND/OR filter operator. + */ + getFilterOperator(): LogicalOperator + + /** + * Returns an Sdk.Collection of Sdk.Query.FilterExpression. + */ + getFilters(): Sdk.Collection; + + /** + * Gets whether the expression is part of a quick find query. + */ + getIsQuickFindFilter(): boolean; + + /** + * Sets the filter operator. + * @param filterOperator The filter operator. + */ + setFilterOperator( filterOperator: LogicalOperator ): void; + + /** + * Sets whether the expression is part of a quick find query. + * @param isQuickFind True if the filter is part of a quick find query; otherwise, false. + */ + setIsQuickFindFilter( isQuickFind: boolean ): void; + } + + class FetchExpression + { + /** + * @param fetchXml The FetchXml to be used in a query. + */ + constructor( fetchXml: string ); + + /** + * Gets the FetchXml to be used in a query. + */ + public getFetchXml(): string; + + /** + * Sets the FetchXml to be used in a query. + * @param fetchXml The FetchXml to be used in a query. + */ + public setFetchXml( fetchXml: string ): void; } class LinkEntity { + /** + * Initializes a new instance of the Sdk.Query.LinkEntity class setting the required properties. + * @param linkFromEntityName The logical name of the entity to link from. + * @param linkToEntityName The logical name of the entity to link to. + * @param linkFromAttributeName The name of the attribute to link from. + * @param linkToAttributeName The name of the attribute to link to. + * @param joinOperator The join operator. + * @param entityAlias The string representing an alias for the linkToEntityName. + */ + constructor( + linkFromEntityName: string, + linkToEntityName: string, + linkFromAttributeName: string, + linkToAttributeName: string, + joinOperator: Sdk.Query.JoinOperator, + entityAlias: string ); + + /** + * Adds a linked entity. + * @param linkEntity An Sdk.Query.LinkEntity to add. + */ + public addLink( linkEntity: Sdk.Query.LinkEntity ): void; + + /** + * Gets the column set. + */ + public getColumns(): Sdk.ColumnSet; + + /** + * Sets the columns to include. + * @param columns An Sdk.ColumnSet instance. + */ + public setColumns( columns: Sdk.ColumnSet ): void; + + /** + * Sets the columns to include. + * @param columns An Array of attribute logical names for the columns to return. + */ + public setColumns( columns: string[] ): void; + + /** + * Sets the columns to include. + * @param columns Pass each attribute logical name as an argument. + */ + public setColumns( ...columns: string[] ): void; + + /** + * Gets the alias for the entity. + */ + public getEntityAlias(): string; + + /** + * Sets the alias for the entity. + * @param alias The alias for the entity. + */ + public setEntityAlias( alias: string ): void; + + /** + * Gets the join operator. + */ + public getJoinOperator(): Sdk.Query.JoinOperator; + + /** + * Sets the join operator. + * @param operator The join operator. + */ + public setJoinOperator( operator: Sdk.Query.JoinOperator ): void; + + /** + * Gets the complex condition and logical filter expressions that filter the results of the query. + */ + public getLinkCriteria(): Sdk.Query.FilterExpression; + + /** + * Sets the complex condition and logical filter expressions that filter the results of the query. + * @param criteria The complex condition and logical filter expressions that filter the results of the query. + */ + public setLinkCriteria( criteria: Sdk.Query.FilterExpression ): void; + + /** + * Gets the collection of Sdk.Query.LinkEntity that define links between multiple entity types. + */ + public getLinkEntities(): Sdk.Collection; + + /** + * Gets the logical name of the attribute of the entity that you are linking from. + */ + public getLinkFromAttributeName(): string; + + /** + * Sets the logical name of the attribute of the entity that you are linking from. + * @param name The logical name of the attribute of the entity that you are linking from. + */ + public setLinkFromAttributeName( name: string ): void; + + /** + * Gets the logical name of the entity that you are linking from. + */ + public getLinkFromEntityName(): string; + + /** + * Sets the logical name of the entity that you are linking from. + * @param name The logical name of the entity that you are linking from. + */ + public setLinkFromEntityName( name ): void; + + /** + * Gets the logical name of the attribute of the entity that you are linking to + */ + public getLinkToAttributeName(): string; + + /** + * Sets the logical name of the attribute of the entity that you are linking to. + * @param name The logical name of the attribute of the entity that you are linking to. + */ + public setLinkToAttributeName( name: string ): void; + + /** + * Gets the logical name of the entity that you are linking to. + */ + public getLinkToEntityName(): string; + + /** + * Sets the logical name of the entity that you are linking to. + * @param name The logical name of the entity that you are linking to. + */ + public setLinkToEntityName( name: string ): void; + + /** + * Gets the serialized link entity. + */ + public toXml(): string; + + /** + * Gets the serialized link entity values. + */ + public toValueXml(): string; } class PagingInfo @@ -1505,77 +1833,12 @@ declare module Sdk.Query * Gets the serialized paging info. * toXml():string; - + /** * Gets the serialized paging info values. */ toValueXml(): string; } - - class Util - { - /** - * Verifies the parameter is a string formatted as a GUID. - * @param value The value to check. - */ - isGuid( value: string ): boolean; - - /** - * Verifies the parameter is a string formatted as a GUID or null. - * @param value The value to check. - */ - isGuidOrNull( value: string ): boolean; - - /** - * Verifies the parameter is a valid enum value. - * @param enumeration The enumeration. - * @param value The value to check. - */ - - /** - * Returns an empty GUID. - */ - getEmptyGuid(): string; - - /** - * Formats a string with the arguments from an array. - * @param string The string containing placeholders for items in the array. - * @param args An array of strings to replace the placeholders. - */ - format( string: string, args: Array ); - - /** - * - */ - getError( resp ): string; - - /** - * Returns the clinent URL. - */ - getClientUrl(): string; - - /** - * Provides a way to override the client Url when a client-side context is not available. - * @param url The client URL to use instead of the default. - */ - setClientUrl( url: string ): void; - - /** - * - */ - getXMLHttpRequest( action, async: boolean ); - - /** - * Creates an entity from XML. - * @param The serialized entity returned from the SOAP service as XML. - */ - createEntityFromNode( node: string ); - } - - class Xml - { - - } export enum ConditionOperator { @@ -1654,9 +1917,11 @@ declare module Sdk.Query EqualUserTeams, } - export class JoinOperator + export enum JoinOperator { - constructor(); + Inner, + LeftOuter, + Natural, } export enum OrderType @@ -1669,54 +1934,350 @@ declare module Sdk.Query { } /** - * Specifies the Guid values to be compared in the query. - * @param An Array of String values + * Specifies Boolean values to be compared in the query. + * @param args An array of Boolean values. + */ + class Booleans extends ValueBase + { + constructor( args: boolean[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of boolean values. + */ + public getValues(): Sdk.Collection; + + + /** + * Specifies a Boolean value to be compared in the query. + * @param setValueArgs An array of boolean values. + */ + public setValues( setValueArgs: boolean[] ); + } + + /** + * Specifies the Date values to be compared in the query. + * @param args An array of Date values. + */ + class Dates extends ValueBase + { + constructor( args: Date[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of Date values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Date values to be compared in the query. + * @param setValueArgs An array of Date values. + */ + public setValues( setValueArgs: Date[] ): void; + } + + /** + * Specifies the Decimal values to be compared in the query. + * @param args An array of Decimal values. + */ + class Decimals extends ValueBase + { + constructor( args: number[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of number values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Decimal values to be compared in the query. + * @param setValueArgs An array of number values. + */ + public setValues( setValueArgs: number[] ): void; + } + + /** + * Specifies the Double values to be compared in the query. + * @param args An array of Double values. + */ + class Doubles extends ValueBase + { + constructor( args: number[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of number values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Double values to be compared in the query. + * @param setValueArgs An array of number values. + */ + public setValues( setValueArgs: number[] ): void; + } + + /** + * Specifies the Int values to be compared in the query. + * @param args An array of Int values. + */ + class Ints extends ValueBase + { + constructor( args: number[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of number values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Int values to be compared in the query + * @param setValueArgs An array of number values. + */ + public setValues( setValueArgs: number[] ): void; + } + + /** + * Specifies the Long values to be compared in the query. + * @param args An array of Long values. + */ + class Longs extends ValueBase + { + constructor( args: number[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of number values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Long values to be compared in the query. + * @param setValueArgs An array of number values. + */ + public setValues( setValueArgs: number[] ): void; + } + + /** + * Specifies the Sdk.EntityReference values to be compared in the query. + * @param args An array of Sdk.EntityReference values. + */ + class EntityReferences extends ValueBase + { + constructor( args: Sdk.EntityReference[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of Sdk.EntityReference values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Long values to be compared in the query. + * @param setValueArgs An array of Sdk.EntityReference values. + */ + public setValues( setValueArgs: Sdk.EntityReference[] ): void; + } + + /** + * Specifies the Sdk.Query.Guids values to be compared in the query. + * @param args An array of GUID string values. */ class Guids extends ValueBase { - constructor( args: Array ); + constructor( args: string[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of GUID string values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Long values to be compared in the query. + * @param setValueArgs An array of GUID string values. + */ + public setValues( setValueArgs: string[] ): void; + } + + /** + * Specifies the Money values to be compared in the query. + * @param args An array of number values. + */ + class Money extends ValueBase + { + constructor( args: number[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of number values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the Money values to be compared in the query. + * @param setValueArgs An array of number values. + */ + public setValues( setValueArgs: number[] ): void; + } + + /** + * Specifies the OptionSet values to be compared in the query. + * @param args An array of number values. + */ + class OptionSets extends ValueBase + { + constructor( args: number[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of number values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the OptionSet values to be compared in the query. + * @param setValueArgs An array of number values. + */ + public setValues( setValueArgs: number[] ): void; + } + + /** + * Specifies the String values to be compared in the query. + * @param args An array of String values. + */ + class Strings extends ValueBase + { + constructor( args: string[] ); + + /** + * Returns the type of value with namespace prefix. + */ + public getType(): string; + + /** + * Returns an Sdk.Collection of String values. + */ + public getValues(): Sdk.Collection; + + /** + * Specifies the String values to be compared in the query. + * @param setValueArgs An array of String values. + */ + public setValues( setValueArgs: string[] ): void + } + + class LogicalOperator + { + public static Or; + public static And; } } -declare module Sdk +declare module Sdk.Util { /** - * Request to retrieve metadata and metadata changes. - * @param query The Sdk.Mdq.EntityQueryExpression that defines the query. - * @param clientVersionStamp The Sdk.Mdq.RetrieveMetadataChangesResponse.ServerVersionStamp value from a previous request. When included only the metadata changes since the previous request will be returned. - * @param deletedMetadataFilters An Sdk.Mdq.DeletedMetadataFilters enumeration value. When included the deleted metadata changes will be limited to the types defined by the enumeration. + * Verifies the parameter is a string formatted as a GUID. + * @param value The value to check. */ - export class RetrieveMetadataChangesRequest - { - constructor( query: Sdk.Mdq.EntityQueryExpression, clientVersionStamp?: string, deletedMetadataFilters?: Sdk.Mdq.DeletedMetadataFilters ); - getEntityMetadata(): Sdk.Mdq.IEntityMetadata[]; - getServerVersionStamp(): string; - getDeletedMetadata(): Object; - } + function isGuid( value: string ): boolean; + + /** + * Verifies the parameter is a string formatted as a GUID or null. + * @param value The value to check. + */ + function isGuidOrNull( value: string ): boolean; + + /** + * Verifies the parameter is a valid enum value. + * @param enumeration The enumeration. + * @param value The value to check. + */ + + /** + * Returns an empty GUID. + */ + function getEmptyGuid(): string; + + /** + * Formats a string with the arguments from an array. + * @param string The string containing placeholders for items in the array. + * @param args An array of strings to replace the placeholders. + */ + function format( string: string, args: Array ); + + /** + * + */ + function getError( resp ): string; + + /** + * Returns the clinent URL. + */ + function getClientUrl(): string; + + /** + * Provides a way to override the client Url when a client-side context is not available. + * @param url The client URL to use instead of the default. + */ + function setClientUrl( url: string ): void; /** - * Response to RetrieveMetadataChangesRequest. - * @param resopnseXml The response XML. + * */ - export class RetrieveMetadataChangesResponse - { - constructor( responseXml: string ); + function getXMLHttpRequest( action, async: boolean ); + + /** + * Creates an entity from XML. + * @param The serialized entity returned from the SOAP service as XML. + */ + function createEntityFromNode( node: string ); +} - /*** - * - */ - public getEntityMetadata(): Array; - - /*** - * - */ - public getServerVersionStamp(); - - /*** - * - */ - public getDeletedMetadata(); - } +declare module Sdk.Xml +{ } declare module Sdk.Mdq @@ -1757,6 +2318,7 @@ declare module Sdk.Mdq * Specifies complex condition and logical filter expressions used for filtering the results of a metadata query. * @param filterOperator The logical AND/OR filter operator. */ + export class MetadataFilterExpression { constructor( filterOperator: Sdk.Mdq.LogicalOperator ); @@ -1771,6 +2333,16 @@ declare module Sdk.Mdq propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, conditionOperator: MetadataConditionOperator, value: Object ); + addCondition(propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator, value: any); + public addCondition( + propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, + conditionOperator: MetadataConditionOperator, + value: Object ); + addCondition(propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator); + public addCondition( + propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, + conditionOperator: MetadataConditionOperator, + value: Object); } /** @@ -1790,7 +2362,7 @@ declare module Sdk.Mdq */ export class RelationshipQueryExpression { - constructor( criteria: MetadataFilterExpression, properties: Sdk.Mdq.MetadataPropertiesExpression ); + constructor( criteria: MetadataFilterExpression, properties: Mdq.MetadataPropertiesExpression ); } /** @@ -1818,7 +2390,7 @@ declare module Sdk.Mdq */ export class MetadataPropertiesExpression { - constructor( allProperties: boolean, propertyNames?: Array ); + constructor( allProperties: boolean, propertyNames?: Array ); } export enum RelationshipMetadataProperties @@ -2092,38 +2664,38 @@ declare module Sdk.Mdq export interface IEntityMetadata { - ActivityTypeMask: any; + ActivityTypeMask; Attributes: Array; - AutoCreateAccessTeams: any; + AutoCreateAccessTeams; AutoRouteToOwnerQueue: boolean; - CanBeInManyToMany: any; - CanBePrimaryEntityInRelationship: any; - CanBeRelatedEntityInRelationship: any; - CanCreateAttributes: any; - CanCreateCharts: any; - CanCreateForms: any; - CanCreateViews: any; - CanModifyAdditionalSettings: any; + CanBeInManyToMany; + CanBePrimaryEntityInRelationship; + CanBeRelatedEntityInRelationship; + CanCreateAttributes; + CanCreateCharts; + CanCreateForms; + CanCreateViews; + CanModifyAdditionalSettings; CanTriggerWorkflow: boolean; - Description: any; - DisplayCollectionName: any; - DisplayName: any; - IconLargeName: any; - IconMediumName: any; - IconSmallName: any; - IntroducedVersion: any; + Description; + DisplayCollectionName; + DisplayName; + IconLargeName; + IconMediumName; + IconSmallName; + IntroducedVersion; IsActivity: boolean; IsActivityParty: boolean; - IsAIRUpdated: any; - IsAuditEnabled: any; + IsAIRUpdated; + IsAuditEnabled; IsAvailableOffline: boolean; - IsBusinessProcessEnabled: any; + IsBusinessProcessEnabled; IsChildEntity: boolean; - IsConnectionsEnabled: any; + IsConnectionsEnabled; IsCustomEntity: boolean; - IsCustomizable: any; + IsCustomizable; IsDocumentManagementEnabled: boolean; - IsDuplicateDetectionEnabled: any; + IsDuplicateDetectionEnabled; IsEnabledForCharts: boolean; IsImportable: boolean; IsIntersect: boolean; @@ -2138,66 +2710,161 @@ declare module Sdk.Mdq IsVisibleInMobile: boolean; IsVisibleInMobileClient: boolean; LogicalName: string; - ManyToManyRelationships: any; - ManyToOneRelationships: any; - MetadataId: any; + ManyToManyRelationships; + ManyToOneRelationships; + MetadataId; ObjectTypeCode: number; - OneToManyRelationships: any; + OneToManyRelationships; OwnershipType: string; PrimaryIdAttribute: string; - PrimaryImageAttribute: any; + PrimaryImageAttribute; PrimaryNameAttribute: string; - Privileges: any; - RecurrenceBaseEntityLogicalName: any; + Privileges; + RecurrenceBaseEntityLogicalName; ReportViewName: string; SchemaName: string; } export interface IAttributeMetadata { - AttributeOf: any; - AttributeType: any; - AttributeTypeName: any; - CalculationOf: any; - CanBeSecuredForCreate: any; - CanBeSecuredForRead: any; - CanBeSecuredForUpdate: any; - CanModifyAdditionalSettings: any; - ColumnNumber: any; - DefaultFormValue: any; - DefaultValue: any; - DeprecatedVersion: any; - Description: any; - DisplayName: any; - EntityLogicalName: any; - Format: any; - FormatName: any; - ImeMode: any; - IntroducedVersion: any; - IsAuditEnabled: any; - IsCustomAttribute: any; - IsCustomizable: any; - IsManaged: any; - IsPrimaryId: any; - IsPrimaryName: any; - IsRenameable: any; - IsSecured: any; - IsValidForAdvancedFind: any; - IsValidForCreate: any; - IsValidForRead: any; - IsValidForUpdate: any; - LinkedAttributeId: any; - LogicalName: any; - MaxLength: any; - MaxValue: any; - MetadataId: any; - MinValue: any; - OptionSet: any; - Precision: any; - PrecisionSource: any; - RequiredLevel: any; - SchemaName: any; + AttributeOf; + AttributeType; + AttributeTypeName; + CalculationOf; + CanBeSecuredForCreate; + CanBeSecuredForRead; + CanBeSecuredForUpdate; + CanModifyAdditionalSettings; + ColumnNumber; + DefaultFormValue; + DefaultValue; + DeprecatedVersion; + Description; + DisplayName; + EntityLogicalName; + Format; + FormatName; + ImeMode; + IntroducedVersion; + IsAuditEnabled; + IsCustomAttribute; + IsCustomizable; + IsManaged; + IsPrimaryId; + IsPrimaryName; + IsRenameable; + IsSecured; + IsValidForAdvancedFind; + IsValidForCreate; + IsValidForRead; + IsValidForUpdate; + LinkedAttributeId; + LogicalName; + MaxLength; + MaxValue; + MetadataId; + MinValue; + OptionSet; + Precision; + PrecisionSource; + RequiredLevel; + SchemaName; Targets: string[]; - YomiOf: any; + YomiOf; + } + + module ValueEnums + { + export enum OwnershipType + { + None, + OrganizationOwned, + TeamOwned, + UserOwned, + } + + export enum AttributeTypeCode + { + BigInt, + Boolean, + CalendarRules, + Customer, + DateTime, + Decimal, + Double, + EntityName, + Integer, + Lookup, + ManagedProperty, + Memo, + Money, + Owner, + PartyList, + Picklist, + State, + Status, + String, + Uniqueidentifier, + Virtual, + } + + + export enum AttributeRequiredLevel + { + ApplicationRequired, + None, + Recommended, + SystemRequired, + } + + + export enum DateTimeFormat + { + DateAndTime, + DateOnly, + } + + export enum ImeMode + { + Active, + Auto, + Disabled, + Inactive, + } + + + + export enum IntegerFormat + { + Duration, + Language, + Locale, + None, + TimeZone, + } + + + export enum SecurityTypes + { + Append, + Inheritance, + None, + ParentChild, + Pointer, + } + + export enum StringFormat + { + Email, + PhoneticGuide, + Text, + TextArea, + TickerSymbol, + Url, + VersionNumber, + } } } + +declare module Sdk.Mdq.ValueEnums +{ } From f202af5bbd1ed316920e8de9ec7a802c629f2e5a Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 14:51:32 +0100 Subject: [PATCH 08/11] Add QueryExpression test --- .../microsoft-sdk-soap-tests.ts | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts b/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts index 78deb50fb6..5ac7601c9f 100644 --- a/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts +++ b/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts @@ -1,11 +1,21 @@ -/// +/// -var query = new Sdk.Query.QueryByAttribute( "account" ); -query.addColumn( "accountnumber" ); -query.addAttributeValue( new Sdk.String( "name", "acme" ) ); -Sdk.Q.retrieveMultiple( query ).then( entityCollection => +// QueryByAttribute +var queryByAttribute = new Sdk.Query.QueryByAttribute( "account" ); +queryByAttribute.addColumn( "accountnumber" ); +queryByAttribute.addAttributeValue( new Sdk.String( "name", "acme" ) ); +Sdk.Q.retrieveMultiple( queryByAttribute ).then( entityCollection => { var first = entityCollection.getEntities().getByIndex( 0 ); var accountNumber = first.getAttributes().getAttributeByName( "accountnumber" ); console.log( "Account 'acme' has the Account Number '" + accountNumber + "'" ); -} ); \ No newline at end of file +} ); + +// QueryExpression +var queryExpression = new Sdk.Query.QueryExpression( "account" ); +queryExpression.setColumnSet( new Sdk.ColumnSet( true ) ); +queryExpression.addCondition( "account", "accountname", Sdk.Query.ConditionOperator.BeginsWith, new Sdk.Query.Strings( [ "abc", "xyz" ] ) ); +Sdk.Q.retrieveMultiple( queryExpression ).then( entityCollection => +{ + console.log( "Query matches " + entityCollection.getTotalRecordCount() + " records." ); +} ); \ No newline at end of file From 8bba715b5e1be6d19bce5ba8c8160be8af726ca8 Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 15:28:14 +0100 Subject: [PATCH 09/11] Fixing automated test errors --- microsoft-sdk-soap/microsoft-sdk-soap.ts | 214 +++++++++++------------ 1 file changed, 104 insertions(+), 110 deletions(-) diff --git a/microsoft-sdk-soap/microsoft-sdk-soap.ts b/microsoft-sdk-soap/microsoft-sdk-soap.ts index f70de774ac..1aa445109c 100644 --- a/microsoft-sdk-soap/microsoft-sdk-soap.ts +++ b/microsoft-sdk-soap/microsoft-sdk-soap.ts @@ -140,19 +140,19 @@ declare module Sdk * Adds a column to the collection. * @param column The logical name of the attribute to add. */ - addColumn( column: string ); + addColumn( column: string ): void; /** * Adds a string array of column names. * @param columns A string array of column names. */ - addColumns( columns: Array ); + addColumns( columns: Array ): void; /** * Sets the AllColumns property. * @params allColumns A boolean value. */ - setAllColumns( allColumns: boolean ); + setAllColumns( allColumns: boolean ): void; /** * Whether all columns will be returned. @@ -242,7 +242,7 @@ declare module Sdk * Applies the action contained within a delegate function. * @param fn Delegate function with parameters for item and index. */ - forEach( fn: ( item: T, index: number ) => any ); + forEach( fn: ( item: T, index: number ) => any ): void; /** * Gets the item in the collection at the specified index. @@ -376,7 +376,7 @@ declare module Sdk * Sets whether the results of the query exceeds the total record count. * @param totalRecordCountLimitExceeded Whether the results of the query exceeds the total record count. */ - setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ); + setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ): void; /** * XML definition of an the child nodes of an entity. @@ -406,7 +406,7 @@ declare module Sdk * Sets the collection of entity references. * @param entityReferences The entity references */ - setEntityReferences( entityReferences: Sdk.Collection ); + setEntityReferences( entityReferences: Sdk.Collection ): void; /// prototype methods @@ -415,7 +415,7 @@ declare module Sdk * Removes an entity reference to the collection. * @param entityReference The entity reference to remove. */ - remove( entityReference: Sdk.EntityReference ); + remove( entityReference: Sdk.EntityReference ): void; /** * Returns a view of the data in an entity reference collection instance. @@ -550,24 +550,17 @@ declare module Sdk */ setType( type: Sdk.ValueType ): void; - /** - * Internal Use Only - */ - setValidValue( value ); - /** * Sets the general value of the attribute * @param name The value of the attribute. */ - setValue( value: any ); + setValue( value: any ): void; /// prototype methods /** * XML node for Attribute. */ - toXml( action ): string; - - + toXml( action: string ): string; } class Boolean extends AttributeBase @@ -867,7 +860,7 @@ declare module Sdk * Sets the collection of attributes for the entity. * @param attributes The collection of attributes for the entity. */ - setAttributes( attributes: Sdk.AttributeCollection ); + setAttributes( attributes: Sdk.AttributeCollection ): void; /** * Gets the state of the entity. @@ -912,7 +905,7 @@ declare module Sdk * Sets the logical name of the entity. * @param type The logical name of the entity. */ - setType( type ): void; + setType( type: string ): void; /** * Gets a collection of related entities. @@ -930,7 +923,7 @@ declare module Sdk * @param attribute The attribute to add * @param isChanged Whether the attribute should be considered changed, the default is true. */ - addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ); + addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ): void; /** * Adds an entity to the related entities. @@ -948,7 +941,7 @@ declare module Sdk * Sets the value to indicate whether data for the entity has changed. * @param isChanged The value to indicate whether data for the entity has changed. */ - setIsChanged( isChanged: boolean ); + setIsChanged( isChanged: boolean ): void; /** * Gets the value of the specified attribute. @@ -959,7 +952,7 @@ declare module Sdk /** * Generates properties for the entity based on metadata. */ - initializeSubClass( metadata ); + initializeSubClass( metadata: Sdk.Mdq.IEntityMetadata ): void; /** * Sets the value of the specified attribute. @@ -982,12 +975,12 @@ declare module Sdk * XML definition of an the child nodes of an entity. * @param action */ - toValueXml( action ): string; + toValueXml( action: string ): string; /** * XML definition of an entity where the root node is . */ - toXml( action ): string; + toXml( action: string ): string; /** * Returns a view of the data in an entity instance @@ -1174,12 +1167,12 @@ declare module Sdk /*** * */ - public getServerVersionStamp(); + public getServerVersionStamp(): string; /*** * */ - public getDeletedMetadata(); + public getDeletedMetadata(): any; } @@ -1279,7 +1272,7 @@ declare module Sdk.Query * Sets the number of pages and the number of entity instances per page returned from the query. * @param pageInfo The number of pages and the number of entity instances per page returned from the query. */ - setPageInfo( pageInfo: Sdk.Query.PagingInfo ); + setPageInfo( pageInfo: Sdk.Query.PagingInfo ): void; /** * Adds the specified column to the column set. @@ -1308,7 +1301,7 @@ declare module Sdk.Query * Sets the number of rows to be returned. * @param count The number of rows to be returned. */ - setTopCount( count: number ); + setTopCount( count: number ): void; /** * Gets the serialized QueryExpression. @@ -1339,7 +1332,7 @@ declare module Sdk.Query * Sets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. * @param orders An Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. */ - setOrders( orders: Sdk.Collection ); + setOrders( orders: Sdk.Collection ): void; /// prototype methods @@ -1390,7 +1383,7 @@ declare module Sdk.Query /** * Sets whether the results of the query contain duplicate entity instances. */ - setDistinct( isDistinct: boolean ); + setDistinct( isDistinct: boolean ): void; /** * Gets an Sdk.Collection of Sdk.Query.LinkEntity instances. @@ -1956,7 +1949,7 @@ declare module Sdk.Query * Specifies a Boolean value to be compared in the query. * @param setValueArgs An array of boolean values. */ - public setValues( setValueArgs: boolean[] ); + public setValues( setValueArgs: boolean[] ): void; } /** @@ -2251,7 +2244,7 @@ declare module Sdk.Util /** * */ - function getError( resp ): string; + function getError( resp: any ): string; /** * Returns the clinent URL. @@ -2267,13 +2260,13 @@ declare module Sdk.Util /** * */ - function getXMLHttpRequest( action, async: boolean ); + function getXMLHttpRequest( action: string, async: boolean ); /** * Creates an entity from XML. * @param The serialized entity returned from the SOAP service as XML. */ - function createEntityFromNode( node: string ); + function createEntityFromNode( node: string ): void; } declare module Sdk.Xml @@ -2332,17 +2325,18 @@ declare module Sdk.Mdq public addCondition( propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, conditionOperator: MetadataConditionOperator, - value: Object ); - addCondition(propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator, value: any); + value: Object ): void; + public addCondition( + propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator, value: any): void; public addCondition( propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, conditionOperator: MetadataConditionOperator, - value: Object ); + value: Object ): void; addCondition(propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator); public addCondition( propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, conditionOperator: MetadataConditionOperator, - value: Object); + value: Object): void; } /** @@ -2664,38 +2658,38 @@ declare module Sdk.Mdq export interface IEntityMetadata { - ActivityTypeMask; - Attributes: Array; - AutoCreateAccessTeams; + ActivityTypeMask: any; + Attributes: IAttributeMetadata[]; + AutoCreateAccessTeams: any; AutoRouteToOwnerQueue: boolean; - CanBeInManyToMany; - CanBePrimaryEntityInRelationship; - CanBeRelatedEntityInRelationship; - CanCreateAttributes; - CanCreateCharts; - CanCreateForms; - CanCreateViews; - CanModifyAdditionalSettings; + CanBeInManyToMany: boolean; + CanBePrimaryEntityInRelationship: boolean; + CanBeRelatedEntityInRelationship: boolean; + CanCreateAttributes: boolean; + CanCreateCharts: boolean; + CanCreateForms: boolean; + CanCreateViews: boolean; + CanModifyAdditionalSettings: boolean; CanTriggerWorkflow: boolean; - Description; - DisplayCollectionName; - DisplayName; - IconLargeName; - IconMediumName; - IconSmallName; - IntroducedVersion; + Description: string; + DisplayCollectionName: string; + DisplayName: string; + IconLargeName: string; + IconMediumName: string; + IconSmallName: string; + IntroducedVersion: any; IsActivity: boolean; IsActivityParty: boolean; - IsAIRUpdated; - IsAuditEnabled; + IsAIRUpdated: boolean; + IsAuditEnabled: boolean; IsAvailableOffline: boolean; - IsBusinessProcessEnabled; + IsBusinessProcessEnabled: boolean; IsChildEntity: boolean; - IsConnectionsEnabled; + IsConnectionsEnabled: boolean; IsCustomEntity: boolean; - IsCustomizable; + IsCustomizable: boolean; IsDocumentManagementEnabled: boolean; - IsDuplicateDetectionEnabled; + IsDuplicateDetectionEnabled: boolean; IsEnabledForCharts: boolean; IsImportable: boolean; IsIntersect: boolean; @@ -2710,16 +2704,16 @@ declare module Sdk.Mdq IsVisibleInMobile: boolean; IsVisibleInMobileClient: boolean; LogicalName: string; - ManyToManyRelationships; - ManyToOneRelationships; - MetadataId; + ManyToManyRelationships: any; + ManyToOneRelationships: any; + MetadataId: string; ObjectTypeCode: number; - OneToManyRelationships; + OneToManyRelationships: any; OwnershipType: string; PrimaryIdAttribute: string; - PrimaryImageAttribute; + PrimaryImageAttribute: string; PrimaryNameAttribute: string; - Privileges; + Privileges: any; RecurrenceBaseEntityLogicalName; ReportViewName: string; SchemaName: string; @@ -2727,50 +2721,50 @@ declare module Sdk.Mdq export interface IAttributeMetadata { - AttributeOf; - AttributeType; - AttributeTypeName; - CalculationOf; - CanBeSecuredForCreate; - CanBeSecuredForRead; - CanBeSecuredForUpdate; - CanModifyAdditionalSettings; - ColumnNumber; - DefaultFormValue; - DefaultValue; - DeprecatedVersion; - Description; - DisplayName; - EntityLogicalName; - Format; - FormatName; - ImeMode; - IntroducedVersion; - IsAuditEnabled; - IsCustomAttribute; - IsCustomizable; - IsManaged; - IsPrimaryId; - IsPrimaryName; - IsRenameable; - IsSecured; - IsValidForAdvancedFind; - IsValidForCreate; - IsValidForRead; - IsValidForUpdate; - LinkedAttributeId; - LogicalName; - MaxLength; - MaxValue; - MetadataId; - MinValue; - OptionSet; - Precision; - PrecisionSource; - RequiredLevel; - SchemaName; + AttributeOf: any; + AttributeType: any; + AttributeTypeName: string; + CalculationOf: any; + CanBeSecuredForCreate: boolean; + CanBeSecuredForRead: boolean; + CanBeSecuredForUpdate: boolean; + CanModifyAdditionalSettings: boolean; + ColumnNumber: number; + DefaultFormValue: any; + DefaultValue: any; + DeprecatedVersion: any; + Description: string; + DisplayName: string; + EntityLogicalName: string; + Format: any; + FormatName: string; + ImeMode: any; + IntroducedVersion: any; + IsAuditEnabled: boolean; + IsCustomAttribute: boolean; + IsCustomizable: boolean; + IsManaged: boolean; + IsPrimaryId: boolean; + IsPrimaryName: boolean; + IsRenameable: boolean; + IsSecured: boolean; + IsValidForAdvancedFind: boolean; + IsValidForCreate: boolean; + IsValidForRead: boolean; + IsValidForUpdate: boolean; + LinkedAttributeId: string; + LogicalName: string; + MaxLength: number; + MaxValue: any; + MetadataId: string; + MinValue: number; + OptionSet: any; + Precision: any; + PrecisionSource: any; + RequiredLevel: any; + SchemaName: string; Targets: string[]; - YomiOf; + YomiOf: any; } module ValueEnums From 9b38287d7133c959e972c8a12a8c3a16561237dd Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 16:48:19 +0100 Subject: [PATCH 10/11] Fixing automated test errors Renaming file extenstion to d.ts --- .../microsoft-sdk-soap-tests.ts | 5 ++--- ...ft-sdk-soap.ts => microsoft-sdk-soap.d.ts} | 22 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) rename microsoft-sdk-soap/{microsoft-sdk-soap.ts => microsoft-sdk-soap.d.ts} (99%) diff --git a/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts b/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts index 5ac7601c9f..4141bec0d9 100644 --- a/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts +++ b/microsoft-sdk-soap/microsoft-sdk-soap-tests.ts @@ -1,4 +1,4 @@ -/// +/// // QueryByAttribute var queryByAttribute = new Sdk.Query.QueryByAttribute( "account" ); @@ -6,8 +6,7 @@ queryByAttribute.addColumn( "accountnumber" ); queryByAttribute.addAttributeValue( new Sdk.String( "name", "acme" ) ); Sdk.Q.retrieveMultiple( queryByAttribute ).then( entityCollection => { - var first = entityCollection.getEntities().getByIndex( 0 ); - var accountNumber = first.getAttributes().getAttributeByName( "accountnumber" ); + var accountNumber = entityCollection.getEntity( 0 ).getAttributes( "accountnumber" ).getValue(); console.log( "Account 'acme' has the Account Number '" + accountNumber + "'" ); } ); diff --git a/microsoft-sdk-soap/microsoft-sdk-soap.ts b/microsoft-sdk-soap/microsoft-sdk-soap.d.ts similarity index 99% rename from microsoft-sdk-soap/microsoft-sdk-soap.ts rename to microsoft-sdk-soap/microsoft-sdk-soap.d.ts index 1aa445109c..bd6c75eb87 100644 --- a/microsoft-sdk-soap/microsoft-sdk-soap.ts +++ b/microsoft-sdk-soap/microsoft-sdk-soap.d.ts @@ -213,7 +213,7 @@ declare module Sdk * Adds an array of objects to the collection. * @param items An array of items to add to the collection. */ - addRange( items ): void; + addRange( items: any[] ): void; /** * Removes all items from the collection. @@ -1200,9 +1200,9 @@ declare module Sdk /** * Sets the status that corresponds to the State property. - * @param value: number The status that corresponds to the State property. + * @param value The status that corresponds to the State property. */ - setStatus( value ): void; + setStatus( value: number ): void; } /** @@ -1739,7 +1739,7 @@ declare module Sdk.Query * Sets the logical name of the entity that you are linking from. * @param name The logical name of the entity that you are linking from. */ - public setLinkFromEntityName( name ): void; + public setLinkFromEntityName( name: string ): void; /** * Gets the logical name of the attribute of the entity that you are linking to @@ -2202,10 +2202,10 @@ declare module Sdk.Query public setValues( setValueArgs: string[] ): void } - class LogicalOperator + export enum LogicalOperator { - public static Or; - public static And; + Or, + And, } } @@ -2239,7 +2239,7 @@ declare module Sdk.Util * @param string The string containing placeholders for items in the array. * @param args An array of strings to replace the placeholders. */ - function format( string: string, args: Array ); + function format( string: string, args: string[] ): string; /** * @@ -2260,7 +2260,7 @@ declare module Sdk.Util /** * */ - function getXMLHttpRequest( action: string, async: boolean ); + function getXMLHttpRequest( action: string, async: boolean ): any; /** * Creates an entity from XML. @@ -2332,7 +2332,7 @@ declare module Sdk.Mdq propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, conditionOperator: MetadataConditionOperator, value: Object ): void; - addCondition(propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator); + addCondition(propertyName: SearchableAttributeMetadataProperties, conditionOperator: MetadataConditionOperator): void; public addCondition( propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, conditionOperator: MetadataConditionOperator, @@ -2714,7 +2714,7 @@ declare module Sdk.Mdq PrimaryImageAttribute: string; PrimaryNameAttribute: string; Privileges: any; - RecurrenceBaseEntityLogicalName; + RecurrenceBaseEntityLogicalName: string; ReportViewName: string; SchemaName: string; } From 9e32530c0f3fb59d0bdf26793b284b183b822ca8 Mon Sep 17 00:00:00 2001 From: Markus Mauch Date: Thu, 3 Mar 2016 16:55:41 +0100 Subject: [PATCH 11/11] Adding reop url --- microsoft-sdk-soap/microsoft-sdk-soap.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/microsoft-sdk-soap/microsoft-sdk-soap.d.ts b/microsoft-sdk-soap/microsoft-sdk-soap.d.ts index bd6c75eb87..217710aac3 100644 --- a/microsoft-sdk-soap/microsoft-sdk-soap.d.ts +++ b/microsoft-sdk-soap/microsoft-sdk-soap.d.ts @@ -1,11 +1,10 @@ // Type definitions for Sdk.Soap.js // Project: https://code.msdn.microsoft.com/SdkSoapjs-9b51b99a -// Definitions by: Markus Mauch +// Definitions by: Markus Mauch // Definitions: https://github.com/borisyankov/DefinitelyTyped /// - declare module Sdk { interface IEntityView