Skip to content

fileshare

fileshare

FileShare_CRUD_Error

FileShare_CRUD_Error(
    operation: str,
    share_id: str | None = None,
    message: str | None = None,
    res=None,
    **kwargs
)

Bases: RouteError

Raised when fileshare create, update, or delete operations fail.

Source code in src/crew_dcs/routes/fileshare.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def __init__(
    self,
    operation: str,
    share_id: str | None = None,
    message: str | None = None,
    res=None,
    **kwargs,
):
    super().__init__(
        message=message or f"FileShare {operation} operation failed",
        entity_id=share_id,
        res=res,
        **kwargs,
    )

FileShare_GET_Error

FileShare_GET_Error(
    share_id: str | None = None,
    message: str | None = None,
    res=None,
    **kwargs
)

Bases: RouteError

Raised when fileshare retrieval operations fail.

Source code in src/crew_dcs/routes/fileshare.py
34
35
36
37
38
39
40
41
42
43
44
45
46
def __init__(
    self,
    share_id: str | None = None,
    message: str | None = None,
    res=None,
    **kwargs,
):
    super().__init__(
        message=message or "FileShare retrieval failed",
        entity_id=share_id,
        res=res,
        **kwargs,
    )

add_share_permissions async

add_share_permissions(
    share_id: str,
    auth: DomoAuth | None = None,
    body: dict[str, Any] | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Add permissions to an existing fileshare.

Source code in src/crew_dcs/routes/fileshare.py
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def add_share_permissions(
    share_id: str,
    auth: DomoAuth | None = None,
    body: dict[str, Any] | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Add permissions to an existing fileshare."""

    context = RouteContext.build_context(context=context, **context_kwargs)
    url = f"https://{auth.domo_instance}.domo.com/fileshare/v1/shares/{share_id}/permissions"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=body or {},
        context=context,
    )

    if not res.is_success:
        raise FileShare_CRUD_Error(
            operation="add permissions", share_id=share_id, res=res
        )

    return res

create_share async

create_share(
    auth: DomoAuth,
    body: dict[str, Any],
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Create a new fileshare.

Source code in src/crew_dcs/routes/fileshare.py
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create_share(
    auth: DomoAuth,
    body: dict[str, Any],
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Create a new fileshare."""

    context = RouteContext.build_context(context=context, **context_kwargs)
    url = f"https://{auth.domo_instance}.domo.com/fileshare/v1/shares"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=body,
        context=context,
    )

    if not res.is_success:
        raise FileShare_CRUD_Error(operation="create", res=res)

    return res

delete_share async

delete_share(
    share_id: str,
    auth: DomoAuth | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Delete a fileshare by ID.

Source code in src/crew_dcs/routes/fileshare.py
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_share(
    share_id: str,
    auth: DomoAuth | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Delete a fileshare by ID."""

    context = RouteContext.build_context(context=context, **context_kwargs)
    url = f"https://{auth.domo_instance}.domo.com/fileshare/v1/shares/{share_id}"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="DELETE",
        context=context,
    )

    if not res.is_success:
        raise FileShare_CRUD_Error(operation="delete", share_id=share_id, res=res)

    return res

get_share_permissions async

get_share_permissions(
    share_id: str,
    auth: DomoAuth | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Return the permission list for a fileshare.

Source code in src/crew_dcs/routes/fileshare.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_share_permissions(
    share_id: str,
    auth: DomoAuth | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Return the permission list for a fileshare."""

    context = RouteContext.build_context(context=context, **context_kwargs)
    url = f"https://{auth.domo_instance}.domo.com/fileshare/v1/shares/{share_id}/permissions"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="GET",
        context=context,
    )

    if not res.is_success:
        raise FileShare_GET_Error(share_id=share_id, res=res)

    return res

get_shares async

get_shares(
    auth: DomoAuth,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Return all fileshares visible to the authenticated user.

Source code in src/crew_dcs/routes/fileshare.py
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_shares(
    auth: DomoAuth,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Return all fileshares visible to the authenticated user."""

    context = RouteContext.build_context(context=context, **context_kwargs)
    url = f"https://{auth.domo_instance}.domo.com/fileshare/v1/shares"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="GET",
        context=context,
    )

    if not res.is_success:
        raise FileShare_GET_Error(res=res)

    return res

update_share async

update_share(
    share_id: str,
    auth: DomoAuth | None = None,
    body: dict[str, Any] | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> ResponseGetData

Update an existing fileshare.

Source code in src/crew_dcs/routes/fileshare.py
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_share(
    share_id: str,
    auth: DomoAuth | None = None,
    body: dict[str, Any] | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Update an existing fileshare."""

    context = RouteContext.build_context(context=context, **context_kwargs)
    url = f"https://{auth.domo_instance}.domo.com/fileshare/v1/shares/{share_id}"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="PUT",
        body=body or {},
        context=context,
    )

    if not res.is_success:
        raise FileShare_CRUD_Error(operation="update", share_id=share_id, res=res)

    return res