예제 #1
0
            /// <summary>
            /// Gets all relation objects.
            /// </summary>
            /// <returns>The all relation objects.</returns>
            /// <param name="tableName">Table name.</param>
            /// <param name="objectID">Object I.</param>
            /// <param name="columnName">Column name.</param>
            public static MoBackRequest <List <MoBackRow> > GetAllRelationObjects(string tableName, string objectID, string columnName)
            {
                MoBackRequest <List <MoBackRow> > .ResponseProcessor getAllRelationObjectsProcessor = (SimpleJSONNode responseJson) =>
                {
                    SimpleJSONNode   relationJson  = responseJson[columnName];
                    List <MoBackRow> moBackObjects = MoBackRelation.MoBackRowFromRelationJSON(relationJson);
                    return(moBackObjects);
                };

                /*
                 * Sample uri: https://api.moback.com/objectmgr/api/collections/{tableName}/{objectID}?include={columnName}
                 */
                return(new MoBackRequest <List <MoBackRow> >(getAllRelationObjectsProcessor, MoBackURLS.TablesDefault + tableName + "/" + objectID + string.Format("?include={0}", columnName), HTTPMethod.GET));
            }
예제 #2
0
            /// <summary>
            /// Gets all relation pointers.
            /// </summary>
            /// <returns>The all relation pointers.</returns>
            /// <param name="tableName">Table name.</param>
            /// <param name="objectID">Object I.</param>
            /// <param name="columnName">Column name.</param>
            public static MoBackRequest <List <MoBackPointer> > GetAllRelationPointers(string tableName, string objectID, string columnName)
            {
                MoBackRequest <List <MoBackPointer> > .ResponseProcessor getAllRelationPointersProcessor = (SimpleJSONNode responseJson) =>
                {
                    SimpleJSONNode relationJson   = responseJson[columnName];
                    MoBackRelation moBackRelation = MoBackRelation.RelationFromMoBackJSON(relationJson);

                    if (moBackRelation != null)
                    {
                        return(moBackRelation.pointers.ToList());
                    }

                    return(null);
                };

                /*
                 * Sample uri: https://api.moback.com/objectmgr/api/collections/{tableName}/{objectID}
                 */
                return(new MoBackRequest <List <MoBackPointer> >(getAllRelationPointersProcessor, MoBackURLS.TablesDefault + tableName + "/" + objectID, HTTPMethod.GET));
            }