Search Results for

Show / Hide Table of Contents

# Interface IResourceService

This interface has operations for light resource management.

##### Syntax

    public interface IResourceService

### Methods

#### CloneAndPublish(ResourceType, LightResourceInfo)

Creates a clone of an existing resource. The newly created resource will have the same data as the original one, but the properties (name, description, etc.) will be as defined by the resourceInfo parameter.

##### Declaration

    Guid CloneAndPublish(ResourceType resourceType, LightResourceInfo resourceInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource to be cloned.
LightResourceInfo | resourceInfo | The parameters of the resource to be created. The Guid member identifies the resource to be cloned. The IsDefault member is ignored. For all resource types class LightResourceInfo can be used directly. As an alternative, the LightResourceInfo derived class belonging to the specific resource type (as defined by the "Described by class" section of the documentation of the appropriate "ResourceType" enum member) can also be used. However, in this latter case the RuleType for PathRule, and FilterName for FilterConfig resources can not be changed (these are ignored). For language dependent resources (e.g. SegRules) ResourceInfoWithLang can be used, and the resource can be cloned to a different language. One way to keep the original language is to use null as the language code.

##### Returns

Type | Description
--- | ---
System.Guid | The Guid of the newly created resource.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### CreateAndPublish(ResourceType, LightResourceInfo)

Creates a new resource with the parameters specified by the resourceInfo parameter. FilterConfig resources can not be created this way, use ImportNewAndPublish instead to create them.

##### Declaration

    Guid CreateAndPublish(ResourceType resourceType, LightResourceInfo resourceInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource to be created.
LightResourceInfo | resourceInfo | The parameters of the resource to be created. The Guid and IsDefault members of the resourceInfo parameter are ignored. To find out exactly which LightResourceInfo derived class is to be used here for a resource type, see the "Described by class" section of the documentation of the appropriate "ResourceType" enum member (e.g.ResourceInfoWithLang for SegRules).

##### Returns

Type | Description
--- | ---
System.Guid | The Guid of the newly created resource.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### DeleteResource(ResourceType, Guid)

Deletes a resource. If the resource is readonly, an exception is thrown.

##### Declaration

    void DeleteResource(ResourceType resourceType, Guid resourceGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource.
System.Guid | resourceGuid | The guid of the resource to be deleted.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### ExportResource(ResourceType, Guid)

Exports the resource to a file. The format of the file is the same as used by memoQ import/export for the specific resource type.

##### Declaration

    Guid ExportResource(ResourceType resourceType, Guid resourceGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource.
System.Guid | resourceGuid | The guid of the resource.

##### Returns

Type | Description
--- | ---
System.Guid | The guid of the resulting file of the operation. Can be dowloaded using FileManagerService.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### GetResourceInfo(ResourceType, Guid)

Gets information about the specified resource.

##### Declaration

    LightResourceInfo GetResourceInfo(ResourceType resourceType, Guid resourceGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource.
System.Guid | resourceGuid | The guid of the resource.

##### Returns

Type | Description
--- | ---
LightResourceInfo | The LightResourceInfo (or derived object, depending the type of the resource) object describing the resource. To find out exactly which derived class is returned here for a resource type, see the "Described by class" section of the documentation of the appropriate "ResourceType" enum member (e.g.ResourceInfoWithLang for SegRules).

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### ImportNewAndPublish(ResourceType, Guid, LightResourceInfo)

Creates a new resource and imports data from the specified file into it. Certain properties of the new resource are taken from the resourceInfo parameter, while others are taken from the header of the import file and can not be changed. The Name, Description and IsReadonly is taken from the resourceInfo parameter. For other rules see documentation for the resourceInfo parameter below.

##### Declaration

    Guid ImportNewAndPublish(ResourceType resourceType, Guid fileGuid, LightResourceInfo resourceInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource to be newly imported.
System.Guid | fileGuid |
LightResourceInfo | resourceInfo | The properties of the resource to be created. The IsDefault and Guid members of the resourceInfo parameter are ignored. For all resource types class LightResourceInfo can be used directly. As an alternative, the LightResourceInfo derived class belonging to the specific resource type (as defined by the "Described by class" section of the documentation of the appropriate "ResourceType" enum member) can also be used. However, in this latter case the following properties can not be changed (are taken from the header of the import file): LanguageCode for langauge dependent resources (can be null) RuleType for PathRule resources FilterName for FilterConfig resources (can be null)

##### Returns

Type | Description
--- | ---
System.Guid | The Guid of the newly imported resource. Although the header of the import file contains a guid, it is ignored, and a new guid is assigned.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### ListResources(ResourceType, LightResourceListFilter)

Returns the list of the light resources available on the server.

##### Declaration

    LightResourceInfo[] ListResources(ResourceType resourceType, LightResourceListFilter filter = null)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource to be listed.
LightResourceListFilter | filter | Optional filtering to apply. Default null value means no filtering other they resource type.

##### Returns

Type | Description
--- | ---
LightResourceInfo[] | An array of LightResourceInfo (or derived, depending the type of the resource) objects is returned. To find out exactly which derived class is returned here for a resource type, see the "Described by class" section of the documentation of the appropriate "ResourceType" enum member (e.g.ResourceInfoWithLang for SegRules).

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.

#### UpdateResourceProperties(ResourceType, LightResourceInfo)

Updates the properties of a resource.

##### Declaration

    void UpdateResourceProperties(ResourceType resourceType, LightResourceInfo resourceInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
ResourceType | resourceType | The type of the resource to update.
LightResourceInfo | resourceInfo | The new properties of the resource. The Guid member identifies the resource to be updated. The IsDefault member is ignored. For read only resources (for which the Readonly property is true) only the Readonly property can be changed. Changing the Name property renames the resource. For all resource types class LightResourceInfo can be used directly. As an alternative, the LightResourceInfo derived class belonging to the specific resource type (as defined by the "Described by class" section of the documentation of the appropriate "ResourceType" enum member) can also be used. However, in this latter case the following properties can not be changed (these are ignored): LanguageCode for langauge dependent resources (can be null) RuleType for PathRule resources FilterName for FilterConfig resources (can be null)

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business errors that have no specific faults.