| GET,POST,PUT,DELETE,OPTIONS | /v1/CrewAssignments/Equipment/{SelectedDate} |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Location:
id: Optional[str] = None
client_id: Optional[str] = None
name: Optional[str] = None
address1: Optional[str] = None
address2: Optional[str] = None
city: Optional[str] = None
state: Optional[str] = None
zip: Optional[str] = None
phone: Optional[str] = None
fax: Optional[str] = None
url: Optional[str] = None
email: Optional[str] = None
time_zone: Optional[str] = None
active: bool = False
ent_date: datetime.datetime = datetime.datetime(1, 1, 1)
mod_date: datetime.datetime = datetime.datetime(1, 1, 1)
location_image: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Project:
project_i_d: int = 0
project_u_i_d: Optional[str] = None
project_name: Optional[str] = None
image_u_r_l: Optional[str] = None
image_key: Optional[str] = None
client_name: Optional[str] = None
client_phone: Optional[str] = None
client_email: Optional[str] = None
notify_customer_on_visit_completion: bool = False
client_contact_i_d: Optional[int] = None
project_manager_i_d: int = 0
project_manager_name: Optional[str] = None
start_date: Optional[datetime.datetime] = None
end_date: Optional[datetime.datetime] = None
actual_start_date: Optional[datetime.datetime] = None
actual_end_date: Optional[datetime.datetime] = None
job_count: int = 0
crew_member_count: int = 0
crew_avatars_json: Optional[str] = None
crew_names_search: Optional[str] = None
equipment_count: int = 0
material_count: int = 0
project_status_i_d: int = 0
project_status_description: Optional[str] = None
budget: Decimal = decimal.Decimal(0)
cost_to_date: Decimal = decimal.Decimal(0)
project_location: Optional[str] = None
project_type: Optional[str] = None
project_sponsor: Optional[str] = None
created_by: Optional[str] = None
created_at: Optional[datetime.datetime] = None
updated_at: Optional[datetime.datetime] = None
project_description: Optional[str] = None
scope: Optional[str] = None
status_id: int = 0
branch_id: Optional[str] = None
branch_name: Optional[str] = None
location: Optional[Location] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Equipment:
equipment_i_d: int = 0
equipment_name: Optional[str] = None
equipment_type_i_d: int = 0
manufacturer: Optional[str] = None
equipment_type: Optional[str] = None
serial_number: Optional[str] = None
bar_code: Optional[str] = None
equipment_location: Optional[str] = None
image_u_r_l: Optional[str] = None
product_details_u_r_l: Optional[str] = None
record_created_date: datetime.datetime = datetime.datetime(1, 1, 1)
created_by_u_i_d: Optional[str] = None
active: bool = False
notes: Optional[str] = None
rate: Decimal = decimal.Decimal(0)
branch_id: Optional[str] = None
branch_name: Optional[str] = None
ownership: Optional[str] = None
rental_vendor: Optional[str] = None
rental_start: Optional[datetime.datetime] = None
rental_end: Optional[datetime.datetime] = None
projects: List[Project] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ProjectEquipment(Equipment):
project_equipment_i_d: int = 0
project_i_d: int = 0
project_end_date: datetime.datetime = datetime.datetime(1, 1, 1)
first_job_use_date: datetime.datetime = datetime.datetime(1, 1, 1)
last_job_use_date: datetime.datetime = datetime.datetime(1, 1, 1)
equipment_rate: Decimal = decimal.Decimal(0)
job_i_d: int = 0
billed_equipment_rate: Decimal = decimal.Decimal(0)
status: Optional[str] = None
source: Optional[str] = None
overlap_bookings: int = 0
has_booking_conflict: bool = False
conflict_jobs: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CrewAssignmentsEquipmentResponse:
response_status: Optional[ResponseStatus] = None
project_equipment: List[ProjectEquipment] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CrewAssignmentsEquipmentRequest:
selected_date: datetime.datetime = datetime.datetime(1, 1, 1)
project_equipment: List[Equipment] = field(default_factory=list)
Python CrewAssignmentsEquipmentRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/CrewAssignments/Equipment/{SelectedDate} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
SelectedDate: 0001-01-01,
ProjectEquipment:
[
{
EquipmentID: 0,
EquipmentName: String,
EquipmentTypeID: 0,
Manufacturer: String,
EquipmentType: String,
SerialNumber: String,
BarCode: String,
EquipmentLocation: String,
ImageURL: String,
ProductDetailsURL: String,
RecordCreatedDate: 0001-01-01,
CreatedByUID: 00000000000000000000000000000000,
Active: False,
Notes: String,
Rate: 0,
BranchId: 00000000000000000000000000000000,
BranchName: String,
Ownership: String,
RentalVendor: String,
RentalStart: 0001-01-01,
RentalEnd: 0001-01-01,
Projects:
[
{
ProjectID: 0,
ProjectUID: 00000000000000000000000000000000,
ProjectName: String,
ImageURL: String,
ImageKey: String,
ClientName: String,
ClientPhone: String,
ClientEmail: String,
NotifyCustomerOnVisitCompletion: False,
ClientContactID: 0,
ProjectManagerID: 0,
ProjectManagerName: String,
StartDate: 0001-01-01,
EndDate: 0001-01-01,
ActualStartDate: 0001-01-01,
ActualEndDate: 0001-01-01,
JobCount: 0,
CrewMemberCount: 0,
CrewAvatarsJson: String,
CrewNamesSearch: String,
EquipmentCount: 0,
MaterialCount: 0,
ProjectStatusID: 0,
ProjectStatusDescription: String,
Budget: 0,
CostToDate: 0,
ProjectLocation: String,
ProjectType: String,
ProjectSponsor: String,
CreatedBy: String,
CreatedAt: 0001-01-01,
UpdatedAt: 0001-01-01,
ProjectDescription: String,
Scope: String,
StatusId: 0,
BranchId: 00000000000000000000000000000000,
BranchName: String,
Location:
{
Id: 00000000000000000000000000000000,
ClientId: 00000000000000000000000000000000,
Name: String,
Address1: String,
Address2: String,
City: String,
State: String,
Zip: String,
Phone: String,
Fax: String,
URL: String,
Email: String,
TimeZone: String,
Active: False,
EntDate: 0001-01-01,
ModDate: 0001-01-01,
LocationImage: String
}
}
]
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
ProjectEquipment:
[
{
ProjectEquipmentID: 0,
ProjectID: 0,
ProjectEndDate: 0001-01-01,
FirstJobUseDate: 0001-01-01,
LastJobUseDate: 0001-01-01,
EquipmentRate: 0,
JobID: 0,
BilledEquipmentRate: 0,
Status: String,
Source: String,
OverlapBookings: 0,
HasBookingConflict: False,
ConflictJobs: String,
EquipmentID: 0,
EquipmentName: String,
EquipmentTypeID: 0,
Manufacturer: String,
EquipmentType: String,
SerialNumber: String,
BarCode: String,
EquipmentLocation: String,
ImageURL: String,
ProductDetailsURL: String,
RecordCreatedDate: 0001-01-01,
CreatedByUID: 00000000000000000000000000000000,
Active: False,
Notes: String,
Rate: 0,
BranchId: 00000000000000000000000000000000,
BranchName: String,
Ownership: String,
RentalVendor: String,
RentalStart: 0001-01-01,
RentalEnd: 0001-01-01,
Projects:
[
{
ProjectID: 0,
ProjectUID: 00000000000000000000000000000000,
ProjectName: String,
ImageURL: String,
ImageKey: String,
ClientName: String,
ClientPhone: String,
ClientEmail: String,
NotifyCustomerOnVisitCompletion: False,
ClientContactID: 0,
ProjectManagerID: 0,
ProjectManagerName: String,
StartDate: 0001-01-01,
EndDate: 0001-01-01,
ActualStartDate: 0001-01-01,
ActualEndDate: 0001-01-01,
JobCount: 0,
CrewMemberCount: 0,
CrewAvatarsJson: String,
CrewNamesSearch: String,
EquipmentCount: 0,
MaterialCount: 0,
ProjectStatusID: 0,
ProjectStatusDescription: String,
Budget: 0,
CostToDate: 0,
ProjectLocation: String,
ProjectType: String,
ProjectSponsor: String,
CreatedBy: String,
CreatedAt: 0001-01-01,
UpdatedAt: 0001-01-01,
ProjectDescription: String,
Scope: String,
StatusId: 0,
BranchId: 00000000000000000000000000000000,
BranchName: String,
Location:
{
Id: 00000000000000000000000000000000,
ClientId: 00000000000000000000000000000000,
Name: String,
Address1: String,
Address2: String,
City: String,
State: String,
Zip: String,
Phone: String,
Fax: String,
URL: String,
Email: String,
TimeZone: String,
Active: False,
EntDate: 0001-01-01,
ModDate: 0001-01-01,
LocationImage: String
}
}
]
}
]
}