C# Class CarDeliveryNetwork.Api.ClientProxy.OpenApi

A wrapper class for the CDN OpenApi
Inheritance: ICdnApi
Datei anzeigen Open project: cardeliverynetwork/openapi.net Class Usage Examples

Public Methods

Method Description
AllocateJobsToFleet ( int id, Jobs jobs, string queryStringParameters = null ) : void

Allocates the specified jobs to this fleet resource.

Call ( string resource, string method, bool isUsingLoadIds = false, IApiEntity data = null, string callParams = null ) : string

Calls the API with the specified resource and method.

CallWithRetry ( string resource, string method, bool isUsingLoadIds = false, IApiEntity data = null, string callParams = null ) : string

Calls the API with the specified resource and method. Retries 3 times on "Unable to connect to the remote server"

CancelJob ( int id, string reason ) : void

Cancels the job of the specified Id giving the specified reason

CancelJob ( string loadId, string reason ) : void

Cancels the job of the specified LoadId giving the specified reason

CreateFleetDevices ( string fleetId, Devices devices, bool isCmac, bool sendTestJob ) : Devices

Creates the specified devices against the specified Fleet.

CreateFleetTrucks ( string fleetId, Trucks trucks, bool isCmac ) : Trucks

Creates the specified trucks against the specified Fleet.

CreateFleets ( Fleets fleets ) : Users

Attempts to create the specified fleets on Car Delivery Network.

CreateJob ( Job job ) : Job

Create the specified job on Car Delivery Network.

CreateJobVehicles ( int jobId, Vehicles vehicles ) : Vehicles

Attempts to create the specified vehicles on the specified job on Car Delivery Network.

CreateJobVehicles ( string loadId, Vehicles vehicles ) : Vehicles

Attempts to create the specified vehicles on the specified job on Car Delivery Network.

CreateJobs ( Jobs jobs ) : Jobs

Attempts to create the specified jobs on Car Delivery Network.

CreateMasterDestinations ( ContactDetailss destinations ) : ContactDetailss

Attempts to create the specified master destinations on Car Delivery Network.

CreateUsers ( Users users ) : Users

Attempts to create the specified users on Car Delivery Network.

GetHomeFleet ( ) : Fleet

Gets the home fleet of the calling user

GetJob ( int id, string callParams = null ) : Job

Gets the job of the specified Id from Car Delivery Network.

GetJob ( string loadId, string callParams = null ) : Job

Gets the job of the specified LoadId from Car Delivery Network.

GetJobDocuments ( int id ) : Documents

Gets the the list of documents for the job of the specified id.

GetJobDocuments ( string loadId ) : Documents

Gets the the list of documents for the job of the specified LoadId.

GetJobVehicles ( int jobId ) : Vehicles

Gets a collection of vehicles form the job of the specified Id

GetJobVehicles ( string loadId ) : Vehicles

Gets a collection of vehicles form the job of the specified LoadId

GetProof ( int id, string pin ) : Proof

Gets the proof document for the endpoint of the specified JobId and Pin.

OpenApi ( string uri, string apiKey = null, string app = null ) : System

Initializes a new instance of the CarDeliveryNetwork.Api.ClientProxy.OpenApi class.

SendJobHooks ( int id, WebHookEvent hookEvent, string doForSchema ) : void

Sends the hooks for the specified hook event, of the specified schema

UpdateJob ( int id, Job job ) : Job

Updates the specified job on Car Delivery Network.

UpdateJob ( string loadId, Job job ) : Job

Updates the specified job on Car Delivery Network.

Private Methods

Method Description
PerformAction ( string resourceName, int id, Data action ) : void
PerformAction ( string resourceName, string loadId, Data action ) : void
PerformJobAction ( int id, Data action ) : void
PerformJobAction ( string loadId, Data action ) : void
UpdateJob ( string resource, Job job, bool isUsingLoadIds ) : Job

Method Details

AllocateJobsToFleet() public method

Allocates the specified jobs to this fleet resource.
public AllocateJobsToFleet ( int id, Jobs jobs, string queryStringParameters = null ) : void
id int Resource Id
jobs Jobs The list of jobs to allocate to this fleet resource
queryStringParameters string Additonal parameters: scheduled dates and buy price
return void

Call() public method

Calls the API with the specified resource and method.
public Call ( string resource, string method, bool isUsingLoadIds = false, IApiEntity data = null, string callParams = null ) : string
resource string The target resource.
method string The HTTP method to perform on the target resource.
isUsingLoadIds bool When true, the target resource is identified by a client specified LoadId.
data IApiEntity The data body for POST and PUT methods.
callParams string Paramater string to be added to the end of the API call.
return string

CallWithRetry() public method

Calls the API with the specified resource and method. Retries 3 times on "Unable to connect to the remote server"
public CallWithRetry ( string resource, string method, bool isUsingLoadIds = false, IApiEntity data = null, string callParams = null ) : string
resource string The target resource.
method string The HTTP method to perform on the target resource.
isUsingLoadIds bool When true, the target resource is identified by a client specified LoadId.
data IApiEntity The data body for POST and PUT methods.
callParams string Paramater string to be added to the end of the API call.
return string

CancelJob() public method

Cancels the job of the specified Id giving the specified reason
public CancelJob ( int id, string reason ) : void
id int Id of job to cancel
reason string Reason for job cancellation
return void

CancelJob() public method

Cancels the job of the specified LoadId giving the specified reason
public CancelJob ( string loadId, string reason ) : void
loadId string LoadId of job to cancel
reason string Reason for job cancellation
return void

CreateFleetDevices() public method

Creates the specified devices against the specified Fleet.
public CreateFleetDevices ( string fleetId, Devices devices, bool isCmac, bool sendTestJob ) : Devices
fleetId string The Fleet Id or 2 RH fields from CMAC
devices Devices The devices to create
isCmac bool Indicates that the fleetId is a CMAC
sendTestJob bool Indicates that a test job should be sent to the new device
return Devices

CreateFleetTrucks() public method

Creates the specified trucks against the specified Fleet.
public CreateFleetTrucks ( string fleetId, Trucks trucks, bool isCmac ) : Trucks
fleetId string The Fleet IdC
trucks Trucks The trucks to create
isCmac bool Indicates that the fleetId is a CMAC
return Trucks

CreateFleets() public method

Attempts to create the specified fleets on Car Delivery Network.
public CreateFleets ( Fleets fleets ) : Users
fleets Fleets The collection of fleets to create.
return Users

CreateJob() public method

Create the specified job on Car Delivery Network.
public CreateJob ( Job job ) : Job
job Job The job to create.
return Job

CreateJobVehicles() public method

Attempts to create the specified vehicles on the specified job on Car Delivery Network.
public CreateJobVehicles ( int jobId, Vehicles vehicles ) : Vehicles
jobId int Id of the job to create vehicles against.
vehicles Vehicles The collection of vehicles to create.
return Vehicles

CreateJobVehicles() public method

Attempts to create the specified vehicles on the specified job on Car Delivery Network.
public CreateJobVehicles ( string loadId, Vehicles vehicles ) : Vehicles
loadId string LoadId of the job to create vehicles against.
vehicles Vehicles The collection of vehicles to create.
return Vehicles

CreateJobs() public method

Attempts to create the specified jobs on Car Delivery Network.
public CreateJobs ( Jobs jobs ) : Jobs
jobs Jobs The collection of jobs to create.
return Jobs

CreateMasterDestinations() public method

Attempts to create the specified master destinations on Car Delivery Network.
public CreateMasterDestinations ( ContactDetailss destinations ) : ContactDetailss
destinations ContactDetailss The collection of master destinations to create.
return ContactDetailss

CreateUsers() public method

Attempts to create the specified users on Car Delivery Network.
public CreateUsers ( Users users ) : Users
users Users The collection of users to create.
return Users

GetHomeFleet() public method

Gets the home fleet of the calling user
public GetHomeFleet ( ) : Fleet
return Fleet

GetJob() public method

Gets the job of the specified Id from Car Delivery Network.
public GetJob ( int id, string callParams = null ) : Job
id int Id of the job to get.
callParams string Paramaters to be added to the API Call URL
return Job

GetJob() public method

Gets the job of the specified LoadId from Car Delivery Network.
public GetJob ( string loadId, string callParams = null ) : Job
loadId string LoadId of the job to get.
callParams string Paramaters to be added to the API Call URL
return Job

GetJobDocuments() public method

Gets the the list of documents for the job of the specified id.
public GetJobDocuments ( int id ) : Documents
id int Job Id
return Documents

GetJobDocuments() public method

Gets the the list of documents for the job of the specified LoadId.
public GetJobDocuments ( string loadId ) : Documents
loadId string Job LoadId
return Documents

GetJobVehicles() public method

Gets a collection of vehicles form the job of the specified Id
public GetJobVehicles ( int jobId ) : Vehicles
jobId int Id of the job resource
return Vehicles

GetJobVehicles() public method

Gets a collection of vehicles form the job of the specified LoadId
public GetJobVehicles ( string loadId ) : Vehicles
loadId string LoadId of the job resource
return Vehicles

GetProof() public method

Gets the proof document for the endpoint of the specified JobId and Pin.
public GetProof ( int id, string pin ) : Proof
id int The Job Id
pin string The EndPoint Pin
return CarDeliveryNetwork.Api.Data.Proof

OpenApi() public method

Initializes a new instance of the CarDeliveryNetwork.Api.ClientProxy.OpenApi class.
public OpenApi ( string uri, string apiKey = null, string app = null ) : System
uri string The uri of the target service.
apiKey string Your API key.
app string The application constructing this OpenApi instance.
return System

SendJobHooks() public method

Sends the hooks for the specified hook event, of the specified schema
public SendJobHooks ( int id, WebHookEvent hookEvent, string doForSchema ) : void
id int Id of job to send hooks for
hookEvent WebHookEvent The hook event to send for
doForSchema string The hook schame to send for
return void

UpdateJob() public method

Updates the specified job on Car Delivery Network.
public UpdateJob ( int id, Job job ) : Job
id int Id of job to update.
job Job The job update.
return Job

UpdateJob() public method

Updates the specified job on Car Delivery Network.
public UpdateJob ( string loadId, Job job ) : Job
loadId string LoadId of job to update.
job Job The job update.
return Job